Good Morning everyone,
My intention is not to get someone to do the whole code to help me but I'm currently learning c++ and I'm working on a homework project to create 10 small programs inside of 1 code and I'm having a hard time doing the last one. It seems this is related to a non Fibonaci numerical series .
The program needs to print the first 200 elements following a conditional numerical series 1-1-3-6-8-8-10-20 where:
a) first 2 digits are 1
b) 3 rd digit is the result of the 2nd +2
c) 4rd digit is the result of the 3rd digit x2
d) 5th digit is the result of the 4th + 2
e) 6th digit is the same as the 5th
Once the above process is over the cycle will be restarted starting on letter b , I've managed to acomplish the letter a by using if condition inside the for loop but I've exhausted all of my knowledge to do points b,c,d and e without suceeding. Below is my code:
int main()
{
int Num1 = 200, a = 0, b= 0, c=0;
for (int i = 1; i <= Num1; i++)
{
if (i == 1)
{
cout << " 1, ";
continue;
}
if (i == 2)
{
cout <<"1, ";
continue;
}
// This are comments of operations I've tried and I get the results I need but 200* 4 = 800 results
//next = a + b
//z = y + 2;
//cout << " " << z << ","; //It will print 3
//z = z * 2;
//cout << " " << z << ",";//It will print 6
//z = z + 2;
//cout << " " << z << ",";//It will print 8
//z = z;
//cout << " " << z << ",";//It will print 8
//y = z;
}
cout << "\n\n";
system("pause");
return 0;
}