Im getting a huge number which is incorrect. please help.

closed account (G20RfSEw)
I am brand new to coding and am trying to learn it myself, Im a business major thinking about switching to computer science, I am stuck with an basic if else statement. if i input 10 hours for example, i get a huge number like 10 characters long. I dont know where i am messing up.

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
#include <iostream>
#include <string>

using namespace std;
int main ( )
{
    double salary, rate, hours;
    int keep_going;
    
    cout << "how many hours you work driving this week?\n";
    cin >> hours;
    
    rate = '10.00';
    if (hours > 40)
    salary = (2 * rate * hours)
    else
    salary = (rate * hours);
    
    cout.setf(ios::fixed);
    cout.setf(ios::showpoint);
    cout.precision(2);
    
    cout << " god damnnnn. you made $" << salary << " dollers this week.\n";
    
    cin >> keep_going; // added just so the program doesnt automatically close without output. 
rate = '10.00'; // this should not even compile
closed account (G20RfSEw)
I think that is the error. because i am gettting a huge number for the answer. it does however compile though. How would i set it so the rate is equal to $10 ?
closed account (j3Rz8vqX)
Look half way down for a quick answer:
http://www.cplusplus.com/doc/tutorial/variables/
closed account (G20RfSEw)
Thank you very much. :)
Topic archived. No new replies allowed.