6 Replies - 1379 Views - Last Post: 16 January 2010 - 10:24 PM Rate Topic: -----

#1 ICU  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 31
  • Joined: 07-January 10

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?)

#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;
}



Is This A Good Question/Topic? 0
  • +

Replies To: error C2447: '{' : missing function header

#2 jjl  Icon User is offline

  • Engineer
  • member icon

Reputation: 1048
  • View blog
  • Posts: 4,455
  • Joined: 09-June 09

Re: error C2447: '{' : missing function header

Posted 16 January 2010 - 05:45 PM

int main ();//<- semi colon


Was This Post Helpful? 0
  • +
  • -

#3 bodom658  Icon User is offline

  • Villiage Idiom
  • member icon

Reputation: 113
  • View blog
  • Posts: 1,123
  • Joined: 22-February 08

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.
Was This Post Helpful? 0
  • +
  • -

#4 jjl  Icon User is offline

  • Engineer
  • member icon

Reputation: 1048
  • View blog
  • Posts: 4,455
  • Joined: 09-June 09

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;
}


Was This Post Helpful? 0
  • +
  • -

#5 ICU  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 31
  • Joined: 07-January 10

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
Was This Post Helpful? 0
  • +
  • -

#6 no2pencil  Icon User is offline

  • Head MFIC
  • member icon

Reputation: 5068
  • View blog
  • Posts: 26,450
  • Joined: 10-May 07

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.
Was This Post Helpful? 0
  • +
  • -

#7 neptunusmaris  Icon User is offline

  • New D.I.C Head

Reputation: -18
  • View blog
  • Posts: 42
  • Joined: 31-July 09

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++)
#include <cstdlib>


Was This Post Helpful? 0
  • +
  • -

Page 1 of 1