problem in a program

I have made a simple program using classes but It is not running . Can anyone please tell me what is wrong with it.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include<iostream>
using namespace std;
class wasim {
	int x;
	int y;
public :
	int function(int a,int b);
	void printmessege();
	double addition(int a,int b);
};
int wasim::function(int a,int b)
{x=a+b;
	return x;
}
void wasim::printmessege()
{
	cout<<"this is string";
}
double wasim::addition (int a ,int b)
{ return (a-b);
}
int main()
{
	wasim tukhi;
	wasim masih;
	wasim bot;
	tukhi.function(4,5);
	masih.printmessege();
	bot.addition(7,8);
	cout<<tukhi.function(4,5)<<"  "<<masih.printmessege<<"  "<<bot.addition(7,8);
	return 0;
}
other than "addition()" actually performing subtraction, I don't see anything wrong with it.

What do you mean by "not running"? I suspect it really is running and is just closing right away. See the sticky thread here:

http://cplusplus.com/forum/beginner/1988/
the printmessege function has a void return type, but you try to output it anyway. Also, you didn't include the parameter brackets. Line 30 should be replaced with:

1
2
3
cout<<tukhi.function(4,5)<<"  ";
masih.printmessege();
cout<<"  "<<bot.addition(7,8);
Thank you jdd !
you cleared my concepts !
Topic archived. No new replies allowed.