Why won't my code cout "fail"?

Why won't my code cout "fail"?
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
#include <iostream>
#include <iomanip>
using namespace std;

int main()
{
int score1, score2, score3, score4, score5, pass, fail, numberOfFailedTests;
cin >> score1 >> score2 >> score3 >> score4 >> score5;

pass = score1 + score2 + score3 + score4 + score5;
fail = score1 + score2 + score3 + score4 + score5;
numberOfFailedTests = 0;

if (score1 < 70)
	numberOfFailedTests + 1;
else if (score2 < 70)
	numberOfFailedTests + 1;
else if (score3 < 70)
	numberOfFailedTests + 1;	     
else if (score4 < 70)
	numberOfFailedTests + 1;	     
else if (score5 < 70)
	numberOfFailedTests + 1;	     	 
else if (pass >= 350 && numberOfFailedTests < 3)
	cout << "pass";	   	
else  	
	cout << "fail";
	
return 0;
}
Because the numberOfFailedTests remains zero forever.

The statement numberOfFailedTests + 1; has no effect. Don't forget to assign the computed value back to numberOfFailedTests.

numberOfFailedTests = numberOfFailedTests + 1;
This is such a common operation that there is "syntactic sugar" for it.
numberOfFailedTests++; and numberOfFailedTests += 1; are both equivalent.
Thank you. :)
but even after fixing that, numberOfFailedTests would be at most 1
Topic archived. No new replies allowed.