+ 1
What's the problem??
double prices[] = {6.99, 8.5, 42.9, 105.4, 42, 98.1, 2.39, 1.99, 68.76, 9.99, 33.67, 105, 99, 67, 24.56, 0.2, 59.87, 77.2}; auto total=0; for(int x = 0;x<18;x++){ total += prices[x]; } cout << total << endl;
6 Respostas
+ 5
Mayank Pal ,
Change this,
auto total=0;
to this.
auto total=0.0;
And, still, please add a tag for the language. Your question appears in a list of just the question headers. It makes it easier for the people who help to know which questions they want to help with if they can see the language without opening it.
+ 4
Please add a tag for the language, and please give your whole code, preferably as a link rather than a paste. If that's C, it's missing main etc.
+ 3
Thanks a lot.
Will never commit the mistake you mentioned 😊
+ 2
We'll, that's c++
+ 1
#include <iostream>
using namespace std;
int main() {
double prices[] = {6.99, 8.5, 42.9, 105.4, 42, 98.1, 2.39, 1.99, 68.76, 9.99, 33.67, 105, 99, 67, 24.56, 0.2, 59.87, 77.2};
auto total=0;
for(int x = 0;x<18;x++){
total += prices[x];
}
cout << total << endl;
return 0;
}
0
How do i get <button to actually do something