dimanche 28 mai 2017

Music Store Machine

I am trying to make a program where I have a store credit of $10 and can buy music from the store. I want to run the code again and again until the balance reaches below $0.99. I tried running this code but it doesn't work. I am a beginner in C++ and would like some help in this matter. Reply back for more info.

 #include <iostream>
 #include <cmath>
 using namespace std;
 {
int main()
double price, balance = 10, rembal;
 while (rembal = balance - price)
    if (price > rembal)
    cout << "your choice is too expensive!!!  Choose another one please!";
    else
    {
    cout << "Enter the cost of the song, ($0.99, $1.99, or $2.99): \n";
        cin >> price;
        cout << rembal;
}
return 0;
}

Aucun commentaire:

Enregistrer un commentaire