what is wrong please?

Please could someone let me know what i'm missing here...?

#include <iostream>
#include <string>
#include <sstream> //#include = what types of coding to be included throughout the coding
using namespace std; //uses the standard library to recognise and process commands
{ int main ()
int answer, a, b, c;
a=5, b=3;
c=a+b;
do {
cout << "\nWhat is 5 + 3?";
cin >> answer;
if (answer != c ) cout << "\nWRONG! Try again."; }
while (answer != c);
cout << "CORRECT!! :)";
cout << " \n"; //the 'press any key to continue...' at the end of programme is shifted down to the next line
return 0;
}


ERROR REPORT:

1>------ Build started: Project: Repeat adding, Configuration: Debug Win32 ------
1> repeat adding.cpp
1>c:\users\katie\documents\visual studio 2010\projects\repeat adding\repeat adding\repeat adding.cpp(5): error C2447: '{' : missing function header (old-style formal list?)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

I am only a beginner trying to learn so explanations would be appreciated. Thanks :)
Last edited on
first of all.. please use code tags:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <iostream>
#include <string>
#include <sstream> //#include = what types of coding to be included throughout the coding
using namespace std; //uses the standard library to recognise and process commands

{ int main ()

  int answer, a, b, c;
  a=5, b=3;
  c=a+b;
  do {
    cout << "\nWhat is 5 + 3?";
    cin >> answer;
    if (answer != c ) cout << "\nWRONG! Try again.";  
  }while (answer != c);
  cout << "CORRECT!! :)";
  cout << " \n"; //the 'press any key to continue...' at the end of programme is shifted down to the next line
  return 0;
}


Now it is easy to see you ahve this wrong:

{ int main () needs to be : int main () {
Last edited on
thanks :) don't know how i missed that lol
I do know ;)

don't place your code to close to each other.
Use less line savers.
It makes it hard to read.
Topic archived. No new replies allowed.