SHARE
TWEET

Untitled

a guest Oct 21st, 2019 89 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // bài 1
  2. #include<iostream>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     cout << "Hello world" << endl;
  8.     system("pause");
  9.     return 0;
  10. }
  11. // bài 2
  12. #include<iostream>
  13. using namespace std;
  14.  
  15. int main()
  16. {
  17.     int x;
  18.     int y;
  19.     cout << "nhap x y";
  20.     cin >> x >> y;
  21.     if (x == 0)
  22.     {
  23.         if (y == 0)
  24.         {
  25.             cout << "tong 2 so  " << x + y << endl;
  26.             cout << "hieu so   " << x - y << endl;
  27.             cout << "tich 2 so  " << x*y << endl;
  28.             cout << "khong co thuong  " << endl;
  29.         }
  30.         else
  31.         {
  32.             cout << "tong 2 so  " << x + y << endl;
  33.             cout << "hieu x-y    " << x - y << endl;
  34.             cout << "hieu so y-x   " << y - x << endl;
  35.             cout << "tich 2 so  " << x*y << endl;
  36.             cout << "thuong so x/y  " << x / y << endl;
  37.         }
  38.  
  39.     }
  40.     else
  41.     {
  42.         if (y == 0)
  43.         {
  44.             cout << "tong 2 so  " << x + y << endl;
  45.             cout << "hieu so x-y   " << x - y << endl;
  46.             cout << "hieu so y-x   " << y - x << endl;
  47.             cout << "tich 2 so  " << x*y << endl;
  48.             cout << "thuong so y/x  " << y / x << endl;
  49.  
  50.         }
  51.         else
  52.         {
  53.             cout << "tong 2 so  " << x + y << endl;
  54.             cout << "hieu so x-y  " << x - y << endl;
  55.             cout << "hieu so y-x  " << y - x << endl;
  56.             cout << "tich 2 so  " << x*y << endl;
  57.             cout << "thuong so x/y  " << x / y << endl;
  58.             cout << "thuong so y/x  " << y / x << endl;
  59.         }
  60.     }
  61.     system("pause");
  62.     return 0;
  63. }
  64. // bài 3
  65. #include<iostream>
  66. using namespace std;
  67.  
  68. int main()
  69. {
  70.     double dSothuc;
  71.     cout << "nhap so thuc  ";
  72.     cin >> dSothuc ;
  73.     cout << static_cast<long long>(dSothuc) << endl;
  74.     system("pause");
  75.     return 0;
  76. }
  77. // bài 4
  78. #include<iostream>
  79. using namespace std;
  80.  
  81. int main()
  82. {
  83.     char a;
  84.     cout << "nhap ki tu bat ky";
  85.     cin >> a;
  86.     cout << static_cast<int>(a) << endl;
  87.     system("pause");
  88.     return 0;
  89. }
  90. // bài 5
  91. #include<iostream>
  92. #include<ctime>
  93. #pragma warning(disable:4996)
  94. using namespace std;
  95.  
  96. int main()
  97. {
  98.     int nYear;
  99.     cout << "nhap nam sinh";
  100.     cin >> nYear;
  101.     time_t baygio = time(0);
  102.     tm*ltm = localtime(&baygio);
  103.     cout << "so tuoi" << 1900 + ltm->tm_year - nYear << endl;
  104.     system("pause");
  105.     return 0;
  106. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top