Need help with classes

This is what I am doing,
Write a class, SalesCls, that contains two attributes (salesAmount and SalesRep). The class must have a constructor and a member function(s). The class must do two main tasks: assign values (any sales amount and any sales representative name name identification) from the main( ) to the attributes of the class. The class also displays the sales representative and his/her sales amount.
The issue I am having is calling my displayvalues function into my main. Can anyone also tell me if I am on the right track?
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
33
34
  #include<iostream>
#include<string>
using namespace std;

class SalesCls{  // class declaration
private:
	double salesAmount;
    string SalesRep;

public:

SalesCls(){ // Constructor
cout << statements<< endl;
cin statement;
cout<<endl;
cin
}
void SalesCls:: displayValues()
	{
		cout<< " Representative "<< SalesRep<<endl;
		cout<< " sales amount "<< salesAmount;
	}
};



int main()
{
	SalesCls::SalesCls ();
	void SalesCls::displayValues();

system("pause");
return 0;
}
Last edited on
Line 29 and 30:
1
2
	SalesCls::SalesCls ();
	void SalesCls::displayValues();


Should be:

1
2
    SalesCls sales; // sales is just an example name. You could use another name.
    sales.displayValues();


Below is the link that could help you grasp about classes a little better.

http://www.cplusplus.com/doc/tutorial/classes/
Last edited on
Thank you so much!
Topic archived. No new replies allowed.