How come my solution only multiples 0.4 not 0.5?Under AccountType 'C' or AccountType'c'

// Steven Cruz
// Assignment #3 pg 227 #11
// IT 1004-01
// March,23,2011

# include <iostream>
# include <string>
using namespace std;

int main()

{ int accountnumber, saving_minimum_balance, checking_minimum_balance, saving_fee, checking_fee, balance;
double checking_interest, saving_interest, special_checking_interest;
char accountType;

checking_interest=.03,saving_interest=.04,special_checking_interest=.05,saving_fee=10,checking_fee=25;

cout<<"please input your account number"<<endl;
cin>>accountnumber;
cout<<endl;

cout<<"Enter account type:"<<endl;
cout<<"S or s (Saving),"<<endl;
cout<<"C or c (checking),"<<endl;
cin>>accountType;
cout<<endl;

cout<<"Enter minimum balance:"<<endl;
cin>>saving_minimum_balance||checking_minimum_balance;
cout<<endl;

cout<<"Enter balance:"<<endl;
cin>>balance;
cout<<endl;



if((accountType='s'|| (accountType='S')))
if(balance>=saving_minimum_balance)
{ balance=balance+(balance*saving_interest);
cout<<"Current balance:"<<balance<<endl;
}
else if(balance<saving_minimum_balance)
{ balance=(balance-saving_fee);
cout<<"Current balance:"<<balance<<endl;
}
else if((accountType='c'|| (accountType='C')))
if(balance>=5000)
{ balance=(balance*special_checking_interest);
cout<<"Current balance:"<<balance<<endl;
}
else if (balance<=5000)
{ balance=(balance*checking_interest);
cout<<balance<<endl;
}
else if(checking_minimum_balance<=5000)
{ balance=(balance-checking_fee);
cout<<balance<<endl;
}

std::cin.get();
std::cin.get();

return 0;
}
Please use tags.

I have fancied it up a little (tags, indenting etc...) and here's what I think is wrong (the //commented parts ) (I'm fairly new, hence the "what I think")

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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// Steven Cruz
// Assignment #3 pg 227 #11
// IT 1004-01
// March,23,2011

# include <iostream>
# include <string> // I haven't seen any strings in the code, so...
using namespace std;

int main()

{ 
    int accountnumber, saving_minimum_balance, checking_minimum_balance, saving_fee,
    checking_fee, balance;
    double checking_interest, saving_interest, special_checking_interest;
    char accountType;
    
    checking_interest=.03, saving_interest=.04, special_checking_interest=.05,
    saving_fee=10, checking_fee=25; 
    // declaring variables and initializing them are different, in declaring, you can do
    //int var1, var 2, var3;
    //In initializing them, you cannot seperate by a comma, you must use a semi colon
    //var1 = 0; var2 = 2; var3 = 7986; etc...

    cout<<"please input your account number"<<endl;
    cin>>accountnumber;
    cout<<endl;

    cout<<"Enter account type:"<<endl;
    cout<<"S or s (Saving),"<<endl;
    cout<<"C or c (checking),"<<endl;
    cin>>accountType;
    cout<<endl;

    cout<<"Enter minimum balance:"<<endl;
    cin>>saving_minimum_balance||checking_minimum_balance; //what is the || for?
    cout<<endl;

    cout<<"Enter balance:"<<endl;
    cin>>balance;
    cout<<endl;

    if((accountType='s'|| (accountType='S')))// why all the brackets? Also ==, not =
    //you need a pair of braces, {}, to enclose the following in this if statement
    if(balance>=saving_minimum_balance)
    { 
        balance=balance+(balance*saving_interest);
        cout<<"Current balance:"<<balance<<endl;
    }
    else if(balance<saving_minimum_balance)
    { 
        balance=(balance-saving_fee);
        cout<<"Current balance:"<<balance<<endl;
    }
    else if((accountType='c'|| (accountType='C'))) //again with the brackets and the ==, not =
    //again with the braces, {}
    if(balance>=5000)
    { 
        balance=(balance*special_checking_interest);
        cout<<"Current balance:"<<balance<<endl;
    }
    else if (balance<=5000)
    { 
        balance=(balance*checking_interest);
        cout<<balance<<endl;
    }
    else if(checking_minimum_balance<=5000)
    { 
        balance=(balance-checking_fee);
        cout<<balance<<endl;
    }

    std::cin.get();//why std::
    std::cin.get();//why std::

    return 0;
} 


It's late and I'm tired, so there's likely more, but this should hopefully be a start.
Topic archived. No new replies allowed.