Logical Operators Help [TCLite] [C++]

Here is my code for a project for school. Simply enter the number of hours worked in a day, and the program tells you your daily wage, including overtime.

I have an issue with the Logical Errors, it's not working for some reason. I'm probably missing something very obvious and am just not seeing what it is, if someone could just look at it and let me know that would be great!

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
//Taylor Lynch
//Bus1
//Calculate the money made by a bus driver with the number of hours entered
//Period 5

#include <conio.h>
#include <iostream.h>
#include <dos.h>
main()
{
	clrscr();
	float hours, cash, cash2;
	cprintf("Please enter the number of hours you work in a day ");
	cin>>hours ;

        if(hours<=8&hours>=1)
	{
        cash=hours*10 ;
	cprintf("The total amount of money made today was $%.2f. ", cash);
	}

	if(hours>8&hours<=24)
	{
        cash2=(hours-8)*15+80;
	
	cprintf("The total amount of money made today was $%.2f. ", cash2);
	}
	if(hours<1||hours>24)
	{
	cprintf("Please enter a number between 1 and 24");
        }
getch();
return 0;
}
1
2
3
if(hours<=8&hours>=1) // supposed to be &&
if(hours>8&hours<=24) // supposed to be &&
if(hours>8&hours<=24) // supposed to be && 


You should also use the spacebar, so it doesn't look like one big mess.

if(hours > 8 && hours <= 24)
Alright, thanks so much. I knew it was going to be a simple stupid thing that I missed.

I really appreciate the help, still trying to learn all of the logical operators.
Topic archived. No new replies allowed.