It should Output
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
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
23:23-46-69-92-115-138-161-184-207-230-253-276-299-322-345-368-391-414-437-460-483-506-529
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
12:12-24-36-48-60-72-84-96-108-120-132-144
4:4-8-12-16
I think I got the answer but I'm doing something wrong in my code, I'm pretty new to programming still and have been doing fine so far till I encounter the loop and functions.
#include<iostream>
usingnamespace std;
void getNumbers( int numbers[], int n )
{
// Your code
}
void printSequence( int numbers[], int n )
{
// Your code
}
void printMultiples( int n )
{
// Your code
}
int main()
{
constint SIZE = 10;
int numbers[SIZE];
getNumbers( numbers, SIZE );
printSequence( numbers, SIZE );
for ( int e : numbers ) printMultiples( e );
}
Your "secretCode" doesn't make much sense. Most codes are invertible/decodeable - yours isn't, because it's many-to-one.
It is also nearly - but not quite - return (char)( 'a' + ( number - 1 ) % 26 );
Was that what you meant? It wouldn't be any more decodeable, but it would at least give a meaningful and plausible output for large n.
There's no need at all for an if block to output '-'. The first parts of the output are always
number : number
and you can easily start the multiples loop from 2* instead of 1*, with '-' output each time.
Maybe you should give the whole problem in its original form. Your "friend" has given you dire code.