if statements issue

hello everyone.

I'm fairly new to c++ and im doing a foundation degree in computing and software development and i am really enjoying the course. We are now learning about if statements and i am stumped on where I have gone wrong in the code below.

When i type in the values that i know are true the program will only return the false. can anyone point out were i have gone wrong please.

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
  #include "stdafx.h"
#include <conio.h>
#include <iostream>

using namespace std;

float student_grade_point;
float admission_point;

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

	cout <<"\n\n\t Please enter student grade point average e.g3.2 ";
		cin >> student_grade_point;

	cout <<"\n\n\t Please enter admission point (0-100) ";
		cin >> admission_point;

		if (((student_grade_point >= 3.0) && (student_grade_point >= 60.0)))
		{
			cout <<"\n\n\t ACCEPT "; // if condition is true print
		}
		else 
		{
			cout << "\n\n\t DECLINE"; // if condition is false print
		}
		
		if (((student_grade_point < 3.0) && (admission_point > 80.0)))
		{
			cout << "\n\n\t ACCEPT "; // if condition is true print
		}
		else 
		{
			cout << "\n\n\t DECLINE"; // if condition is false print
		}

		_getch();
	return 0;
}
When i type in the values that i know are true the program will only return the false

if i enter 70.0 then 81.0 i get true?

if (((student_grade_point >= 3.0) && (student_grade_point >= 60.0)))

are you sure you want to 'and' two tests to test the same variable? This doesn't make much sense to me. Do you want the grade to be over 3 or over 60?
Last edited on
(student_grade_point >= 3.0) && (student_grade_point >= 60.0) are you sure that you need grade point larger than 60 here?
Ah I think I see were I went wrong the second varieble should have been admission_point.

I'll test it tonight and let you know how it worked out. Thank you for the help :-)
Topic archived. No new replies allowed.