Advertisement
Guest User

Untitled

a guest
Oct 21st, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.73 KB | None | 0 0
  1. Bài 1:
  2. #include <iostream>
  3. using namespace std;
  4. int main()
  5. {
  6.     cout<<"Hello World";
  7.     return 0;
  8. }
  9. Bài 2:
  10. #include <iostream>
  11. using namespace std;
  12. int main()
  13. {
  14.     int a,b,tong,tich,hieu;
  15.     float thuong;
  16.     cout<<"nhap a:";
  17.     cin>> a;
  18.     cout<<"nhap b:";
  19.     cin>> b;
  20.     cout<<"\ntong="<<a+b;
  21.     cout<<"\nhieu="<<a-b;
  22.     cout<<"\ntich="<<a*b;
  23.     cout<<"\nthuong="<<(float)a/b;
  24.     return 0;
  25. }
  26. Bài 3
  27. #include <iostream>
  28. using namespace std;
  29. int main()
  30. {
  31.     float a;
  32.     cout<<"nhap so a:";
  33.     cin>> a;
  34.     cout<<"phan nguyen cua so a="<<int(a);
  35.     return 0;
  36. }
  37. Bài 4:
  38. #include <iostream>
  39. using namespace std;
  40. int main()
  41. {
  42.     char a;
  43.     cout<<"Ki tu can chuyen qua ASCII la:";
  44.     cin>> a;
  45.     cout<<"Ma ASCII cua "<< a <<"  la:"<<(int)a;
  46.     return 0;
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement