Tricky One For Me may be simple to others

Write your question here.

Trying to get the user to type in there Name and a score and I output the grades of all the students ! Please help.

How do I go about this
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
 
#include "stdafx.h"
#include <stdlib.h>
#include <iostream>
#include <conio.h>
#include <iomanip>
#include <math.h>
#include <Windows.h>

using namespace std;

int _tmain(int argc, _TCHAR* argv[])

{

	system ("color 1f");
	
	
int score = 0; 
char name, grade;

//input score
    cout << "Enter score: ";
    cin >> score;
	cout << "Enter name: ";
	cin >> name;

if (score == 100)
{
    cout <<"You received a perfect score (A*) Did You Cheat lol \n";
    // 100% is an A. BrainBox
}
else if ((score >= 85) && (score <= 100))
{
    cout << "Your grade is an (A*).\t Great Stuff ! \n";
    // 85-100 is an A*.
}
else if ((score >= 70) && (score <= 84))
{
    cout << "Your grade is a just an (A).\t Well done. \n";
    // 70-84 is a A.
}
else if ((score >= 55) && (score <= 69))
{
    cout << "Your grade is a (B).\t Not Bad ? \n";
    // 55-69 is a B.
}
else if ((score >= 40) && (score <= 54))
{
    cout << "Your grade is a (C).\t Still a pass tho . \n";
    // 40-54 is a C.
}
else if ((score >= 0) && (score <= 39))
{
    cout << "You got an F!\t YOU FAIL! GO JOIN THE DOLE QUEUE. \n";
    // 0-39 is an F.FAIL

}
   _getch();
return 0;
}

rename _tmain() to something like getScore(). Now create a main() function that calls getScore several times.
am new to this sorry I do not understand what you mean I am doing basic c++ programs at the moment
I mean do this:
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#include "stdafx.h"
#include <stdlib.h>
#include <iostream>
#include <conio.h>
#include <iomanip>
#include <math.h>
#include <Windows.h>

using namespace std;


int getScore()
{

	system ("color 1f");
	
	
int score = 0; 
char name, grade;

//input score
    cout << "Enter score: ";
    cin >> score;
	cout << "Enter name: ";
	cin >> name;

if (score == 100)
{
    cout <<"You received a perfect score (A*) Did You Cheat lol \n";
    // 100% is an A. BrainBox
}
else if ((score >= 85) && (score <= 100))
{
    cout << "Your grade is an (A*).\t Great Stuff ! \n";
    // 85-100 is an A*.
}
else if ((score >= 70) && (score <= 84))
{
    cout << "Your grade is a just an (A).\t Well done. \n";
    // 70-84 is a A.
}
else if ((score >= 55) && (score <= 69))
{
    cout << "Your grade is a (B).\t Not Bad ? \n";
    // 55-69 is a B.
}
else if ((score >= 40) && (score <= 54))
{
    cout << "Your grade is a (C).\t Still a pass tho . \n";
    // 40-54 is a C.
}
else if ((score >= 0) && (score <= 39))
{
    cout << "You got an F!\t YOU FAIL! GO JOIN THE DOLE QUEUE. \n";
    // 0-39 is an F.FAIL

}
   _getch();
return 0;
}

int _tmain(int argc, _TCHAR* argv[])

{
    getScore();  // call this for each student
}

Right thanks for that will take a look now thanks for your help
Tried that one it does not work might need to do a do while loop but that's my problem cant get it into my head
Topic archived. No new replies allowed.