🔒 Closed Confused on what to do. [using if else]

Status
Not open for further replies.

-CLAY-

Fanatic
Di ko po kasi mapalabas yung computation palaging 0 lumalabas
Here is my code.

#include <iostream>

using namespace std;

int main() {
double wages;
double workinghours;
double rate;
cout << "Enter an working hours: ";
cin >> workinghours;

if (workinghours < 40)
{
wages = (rate * 40)+(1.5*rate)*(workinghours-40);
cout<<"Your wages is: " << wages << endl;

}
else if ( workinghours > 40) {
wages = rate*workinghours;
cout << "Your wages is: " << wages << endl;
}
}
 

Attachments

  • received_327261264700130.webp
    received_327261264700130.webp
    48.4 KB · Views: 37
  • received_1983319858378138.webp
    received_1983319858378138.webp
    48.1 KB · Views: 21
not sure if naresolve mo na yan, pero pano kung ilagay ko e saktong 40 hehe, like workinghours==40? less and greater than 40 lang ang conditions mo e.
 
Status
Not open for further replies.

About this Thread

  • 5
    Replies
  • 714
    Views
  • 4
    Participants
Last reply from:
Matsiako_07

Trending Topics

Online now

Members online
1,235
Guests online
3,301
Total visitors
4,536

Forum statistics

Threads
2,305,803
Posts
29,167,928
Members
1,195,454
Latest member
goodman777
Back
Top