Issue trying to remember classes

I recently started taking a second C++ class in school and my previous class was almost a year ago and I am having trouble trying to remember how to make everything work.

My Assignment is as follows,

Create a Player Class with the following characteristics{

It contains the following attibutes
Name
Score
It contains the following methods
1. setName
argument: name
argument type: string
return type: nothing
Method sets the value of the private variable Name.
2. getName
argument: none
return type: string
Method retrieves the value of the private variable Name.
3. addPoints
argument: points
argument type: float
returns: total points
return type: float
Method adds the points to the private variable Score.
4. getPoints
argument: none
returns: total points
return type: float
Method returns the value of the private variable Score

My coding so far,

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
35
36
37
38
39
40
41
#include "stdafx.h"
#include <iostream>
#include <string>

using namespace std;

class Player
{
private:
	int Score;
	string Name;
public:
	Player(){
		Score = 0;
		cout << "What is your name?: ";
		cin >> Name;
		cout << "What is your score?: ";
		cin >> Score;	
	}
	void setName(string name){
		Name = name;
	}
	string getName(){
		return(Name);
	}
	float addPoints(float points){
		cout << "How many points would you like to add?: ";
		cin >> points;
		cout << "Score total: " << (points + Score) << endl;;
	}
	float getPoints(){
		return(Score);
	}
};


int _tmain(int argc, _TCHAR* argv[])
{
	Player game;
	return 0;
}



Currently the program will prompt the user for their name and score, but I cannot remember how to get the option for using the method addPoints to be prompted to the user for this application. As of now this code compiles fine however when in the constructor I tried adding addPoints(); my compiler comes back regarding the statement having no arguments since the method declares an argument? I am just at a mental block and reviewing old programs does not seem to be working for such a simple program.

I appreciate any help thank you.
Yes. Since you define your addPoints function to take one argument, you need to pass it one when you call it.
Jeez I did not think of just using Score as the argument instead I kept trying to declare a new int variable. Thanks for your help.
Topic archived. No new replies allowed.