The formatting is terrible, maybe you have a mixture of tabs and spaces. I think you have a couple misplaced braces.
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
example. Note placement of braces and spacing. For more information read this by the author of the c++ language.
#include <iostream>
using namespace std;
int main()
{
std::string line;
int i, p, x;
for(i = 3; i <=100; i++)
{
for(p=2; p<i; p++)
{
if((i%p) == 0)
x = 0;
}
if(x != 0)
cout << i << " is prime\n";
x = 1;
}
getline(cin,line);
cin.get();
return 0;
}
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
how should i improve my formatting, can you please give me an example... i just get lost of what has to be where when im writing
Here's a turotial on Formatting C / C++ code
WaltP
Posting Sage w/ dash of thyme
10,506 posts since May 2006
Reputation Points: 3,348
Solved Threads: 944