Program
Create a program that decodes a numeric message and prints out its "product" sequence
Input
The user will input ten (10) consecutive whole numbers
Output
The program will only process the output if all 10 numbers are encoded. There will be 2 main display of the program. The first one will be the decoded message and the other is the product sequence.
Decoded Message. The 10 numbers will then be decoded according to character equivalent in the English alphabet. Ex
1 = a
2 = b
26 = z
However, this doesn't mean that the program will only evaluate from 1 to 26.
26 = z
52 = z
104 = z
Product Sequence. The second output or sequence of output is the equivalent multiplication table according to the encoded number.
4:4-8-12-16
3:3-6-9
Input #1
0
1
0
1
0
1
0
1
Output #1
a a a a
0:
1:1
0:
1:1
0:
1:1
0:
1:1
#2
8
5
12
15
18
#2
helloworld
8:8-16-24-32-40-48-56-64
5:5-10-15-20-25
12:12-24-36-48-60-72-84-96-108-120-132-144
15:15-30-45-60-75-90-105-120-135-150-165-180-195-210-225
18:18-36-54-72-90-108-126-144-162-180-198-216-234-252-270-288-306-324
#include <iostream>
using namespace std;
int main()
{
char alphabets[26] = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q',
'r','s','t','u','v','w','x','y','z'};
cout<<"Enter the number of integers: ";
int n;
cin>>n;
int arr[n];
for(int i=0; i<n; i++){
cout<<"Number "<<(i+1)<<endl;
int m;
cin>>m;
arr[i] = m - 1;
}
for(int i=0; i<n; i++){
int k = arr[i];
cout<<alphabets[k]<<" ";
}
return 0;
}
Comments
Leave a comment