warning C4305: ‘*=’ : truncation from ‘double’ to ‘float’
error C4700: uninitialized local variable ‘tien’ used
/*tính tiền đi taxi từ km nhập vào. Biết :
a/ 1 km đầu giá 15000 đ.
b/ từ km thứ 2 đến km thứ 5 giá 13500 đ
c/ từ km thứ 6 trở đi giá 11000 đ
d/ nếu trên 120 km giảm 10% tiền*/
#include <iostream>
#include <stdio.h>
using namespace std;
int main(int argc, char argv){
float so_Km;
printf("Nhap so Km nhap vao: ");
cin >> so_Km;
float tien;
if (so_Km <= 1){
tien = 15000;
}
else if (so_Km>1 && so_Km <= 5){
tien = 15000 + 4 * 13500;
}
else if (so_Km>5 && so_Km <= 120){
tien = 1500 + 4 * 13500 + (so_Km - 5) * 11000;
}
else{
tien *= 0.9;
}
printf("so tien phai tra: %f", tien);
system("pause");
return 0;
}



83% thành viên diễn đàn không hỏi bài tập, còn bạn thì sao?