Need Assistance

Hi, I'm new and need some assistance with my very first program.

After trying to figure the problem between me and my roommate, we keep getting the error "expected unqualified-id before '{' token" at line 24. The basis of the program is to calculate interest rates over a given 4 year period where the user prompts his initial investment and interest rate. Coding follows as:

#include <iostream>
#include <iomanip>

using namespace std;

int main();

int i,r,p;
cout << "What is your intital investment? ";
cin >> i;

//int r;
cout << "What is the interest rate? ";
cin >> r;

//int p;
p = i + 4(i * r / 100);

cout << "Initial Investment: "
<< i;
<< "Interest Rate: "
<< r;
<< " Total Payment: "
<< p;

return 0;


I also have some basic info in between /********************* and ******************/ lines (not sure if this would be a factor since it's green.

Any help would be greatly appreciated as I am a newb to coding. Thank you!
Last edited on
Remove semicolon after main()
I did that, now two errors show up at lines 41 and 43. "Expected primary-expression before << token
Either delete semicolon after << i and << r or add cout before next statements.
That did it, thank you!
Topic archived. No new replies allowed.