I cleaned it up some by myself and I know what am I trying to get to but I don't know how to do it. It is not letting me post my screen shot of when I actually ran it :/ but I need it to say for example...
Set 1:0-9
Set 2:9-18
and so on.
Any suggestions? I changed those first two in the if statement to try and see if it would work but no luck on that.
//declare variables
int numbers =0;
int sets =0;
//display first set of numbers
cout << "Numbers:" << endl;
#include <iostream>
usingnamespace std;
int main()
{
//using for loop
for (unsigned i = 0; i <= 117; i += 9)
{
cout << i << endl;
}
//using while loop
unsigned i = 0;
while (i <= 117)
{
cout << i << endl;
i += 9;
}
return 0;
}
Yes, that is what he asked for. If you need them to appear as
Set1: 0, 9, 18 etc.
Then you need to put the cout statements around the loops. Walk through the code identifying what it does, then identify where you need to change it to achieve your final goal. You really only need to add 4 lines and modify 2 other lines to finish this (from the example code I gave you).
Start with what I have posted just above, and work from that instead of your code.
Oh ok awesome! Thank you for your help! Now I'm having trouble with the for statement though :/ Do you know anything that could help or maybe that I looked over?
#include <iostream>
using namespace std;
int main ()
{
//declare variables
int numbers =0;
int sets =0;
//display first set of numbers
cout << "Numbers:" << endl;
//using for loop
for (numbers = 0; numbers <= 117; numbers += 9);
{
cout << numbers << endl;
I don't think you understand what we have given you. Spend some time with the code tweaking it and seeing how the results change. You need to READ what we say and then play with it. You have not listened.