Sign in to follow this  
rappen

Functions

Recommended Posts

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]

Share this post


Link to post
Share on other sites
What error does the compiler give you? If that's your full code, you're missing this:

#include <iostream>
using namespace std;

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this