Functions

Started by
6 comments, last by Palidine 16 years, 11 months ago
Hi, i've got a problem again. he wouldn't compile and run this:

int optellen(int x, int y)
{
  return x+y;	// retourneer x+y 
}

int main()	// main functie
{
  int x,y;	// 2 variabelen declareren
  
  cout <<"2:";	
  cin >> x;				// voer waarde x in
  cout <<"\n4:";
  cin >> y;				// voer waarde y in
  cout << optellen(x,y);		// spring naar de functie optellen en
					// laat de  retour waarde zien

  return 0;
}

Well...what's the problem with this one :S EDIT: sorry guys, This the error he gives :Cout undeclared. - Rappen. [Edited by - rappen on May 10, 2007 8:19:37 AM]
Advertisement
What error does the compiler give you? If that's your full code, you're missing this:
#include <iostream>using namespace std;
What are the errors that the compiler gives?

Steven Yau
[Blog] [Portfolio]

Post your errors. You were told this a number of times in your previous thread.
Yeah sorry the error he gives is: Cout undeclared.
And i already tried with this above the whole source:

#include <iostream>using namespace std;


But it didn't work.

- Rappen.
Quote:Original post by rappen
Yeah sorry the error he gives is: Cout undeclared.

If that's the exact error text then the problem is very likely that you've accidentally typed Cout rather than cout somewhere in your program; programming languages (well, many of them, including C++) are case sensitive.

- Jason Astle-Adams

No, it's just a lowercase letter "c"
please re-post the updated code (in a new post, don't edit the first post of the thread). Also don't give us a summary of the error in your own words, copy-paste the *actual* error.

-me

This topic is closed to new replies.

Advertisement