0
Everyone loves a discount
#include <iostream> using namespace std; int main() { int purchaseAmount; int totalPrice; //your code goes here do{ cin >> totalPrice; purchaseAmount = purchaseAmount + 1; totalPrice = totalPrice * .15; cout << totalPrice << endl; }while(purchaseAmount<3); return 0; } Everything’s correct except last out put How do I make the first 2 outputs normal and the last a float?
9 Respostas
0
@ You're always Welcome😇
+ 1
Cody Silvaggio I think it is 0.15, if I am not wrong. So for that I would say, change the data type to double !!!
+ 1
Cody Silvaggio Actually, There is no restriction on you while attempting any code project, that you can't edit the existing code.😄😄 So you could even use a different approach😎 to run the code correctly. So you can try that!!👍👍
0
Cody Silvaggio can you clarify ' .15' at the end of totalPrice =.......... !! Is it 0.15 or a dot is there by mistake😐
0
Ty!!!
0
Learner_Pratham so i tried double and still only gota the first two out puts correct
0
Cody Silvaggio Okay!! So can you tell the question, what is it saying??
Or you can just tell me the reference of that question
Like: Platform where this question is, the lesson, is it a code project or practise question, etc.
0
Learner_Pratham nvm i figured it out, i was not floating the variable itself but was using float within the equation but then floated the variable and it worked
0
Cody Silvaggio Ok great then👏. Good job👍👍✌.