#include <iostream>
using namespace std;
int main ();
{
int number1;
int number2;
int number3 ( number1 + number2 );
cout << "Please input 2 number variables: " << endl;
cin << number1 << number2;
cout << endl;
cout << "The sum of your numbers is: " << endl;
system("pause");
return 0;
}
error C2447: '{' : missing function headerwth
Page 1 of 1
6 Replies - 1190 Views - Last Post: 16 January 2010 - 10:24 PM
#1
error C2447: '{' : missing function header
Posted 16 January 2010 - 05:39 PM
ok i was making an example code for my brother to see what it takes to code a really simple program and... i get... error C2447: '{' : missing function header (old-style formal list?)
Replies To: error C2447: '{' : missing function header
#2
Re: error C2447: '{' : missing function header
Posted 16 January 2010 - 05:45 PM
int main ();//<- semi colon
#3
Re: error C2447: '{' : missing function header
Posted 16 January 2010 - 05:45 PM
You put a ';' after int main(). Take that out and you should be good to go.
#4
Re: error C2447: '{' : missing function header
Posted 16 January 2010 - 05:47 PM
I dont think hes good to go yet lol what happens when you try to add to numbers together that have not been initalized? ... you bet garbage. Add your numbers together after you input them
#include <iostream>
using namespace std;
int main ()
{
int number1;
int number2;
int number3; // ( number1 + number2 );
cout << "Please input 2 number variables: " << endl;
cin >> number1 >> number2; //cin is >> , cout is <<
cout << endl;
cout << "The sum of your numbers is: " << endl;
number3 = number1 + number2;
cout<<number3;
system("pause");
return 0;
}
#5
Re: error C2447: '{' : missing function header
Posted 16 January 2010 - 05:52 PM
ya i noticed that i forgot to add the numbers together after i posted this but i fixed it while i was waiting so thanks. thats kinda stupid on my part i already made a math program before with help on another topic from about a week ago. grr
#6
Re: error C2447: '{' : missing function header
Posted 16 January 2010 - 09:26 PM
** Renamed title to be more descriptive to discussion **
For future reference, helping address the issue of the question with a descriptive title will prepare someone looking over the list of topics to answer. "WHAT" doesn't really say anything other than "there is a problem", which is pretty obvious since you are posting under a C/C++ forum for problem solving
Glad to see that this problem was corrected.
For future reference, helping address the issue of the question with a descriptive title will prepare someone looking over the list of topics to answer. "WHAT" doesn't really say anything other than "there is a problem", which is pretty obvious since you are posting under a C/C++ forum for problem solving
Glad to see that this problem was corrected.
#7
Re: error C2447: '{' : missing function header
Posted 16 January 2010 - 10:24 PM
Don't you have to include the C standard to use the function "system"?
Like this: (in the case of using C++)
Like this: (in the case of using C++)
#include <cstdlib>
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote





|