Advertisement
Centipede18

HieuBoyBD ;)

May 18th, 2018
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.75 KB | None | 0 0
  1. /*Hoang Khac Minh Hieu
  2.   D17CQCN11-B
  3.   B17DCCN227
  4.   Nhom 22
  5.   STT 34 */
  6. #include <iostream>
  7. using namespace std;
  8.  
  9. int main()
  10. {
  11.     int a,b,c,d;
  12.     cout <<"\nNhap cu ly di duoc trong ngay(km): ";
  13.     cin >> a;
  14.     cout <<"\nNhap luong xang su dung trong ngay(lit): ";
  15.     cin >> b;
  16.     cout <<"\nNhap gia xang cua ngay(VND/1lit): ";
  17.     cin >> c;
  18.     cout <<"Luong xang tieu thu trung binh tren 1km di chuyen la(lit/1km): ";
  19.     printf("%f", (float)(b)/a);
  20.     cout <<"\nSo tien chi cho viec trong giu xe la(VND): ";
  21.     cin >> d;
  22.     cout <<"\nTong so tien chi cho phuong tien di lai trong ngay la: " << b*c+d;
  23.     fstream outfile;
  24.     outfile.open("file.dat", ios::out);
  25.     oufile<<"\nTong so tien chi cho phuong tien di lai trong ngay la: " << b*c+d;
  26.     outfile.close();
  27.     return 0;
  28.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement