Untitled

 avatar
unknown
c_cpp
a month ago
2.3 kB
9
Indexable
// bai 1:
#include <iostream>

using namespace std;

int main()
{
  cout << "Chào mừng bạn đến với lập trình C++ cùng CLB Tin học HIT !\n ";
  return 0;
}

// bai 2:
#include <iostream>
#include <math.h>
using namespace std;

int main()
{
  double a, b;
  cout << "Nhap gia a va b: ";
  cin >> a >> b;
  cout << "Tong: " << a + b << endl;
  cout << "Hieu: " << a - b << endl;
  cout << "Tich: " << a * b << endl;
  cout << "Thuong: " << a / b << endl;
  return 0;
}
// bai 3:
#include <iostream>

using namespace std;

int main() {
    cout << "*     *   *-----*   *----*    *----*    *     *"<< endl;
    cout << "|\\   /|   |         |     \\   |     \\    \\   /" << endl;;
    cout << "| \\ / |   |         |     /   |     /     \\ /" << endl;
    cout << "*  *  *   *-----*   *---*     *---*        * " << endl;
    cout << "|     |   |         |    \\    |    \\       |" << endl;
    cout << "|     |   |         |     \\   |     \\      |" << endl;
    cout << "*     *   *-----*   *      *  *      *     *" << endl;
    cout << "\n";
    cout << "  *---*   *     *   *----*    *    *---*   *-----*   *     *        *         *---*" << endl;
    cout << " /        |     |   |     \\   |   /           |      |\\   /|       / \\       /" << endl;
    cout << "|         |     |   |     /   |   \\           |      | \\ / |      /   \\      \\" << endl;
    cout << "*         *-----*   *---*     *    *---*      *      *  *  *     *-----*      *---*" << endl;
    cout << "|         |     |   |    \\    |         \\     |      |     |    /       \\          \\ " << endl;
    cout << " \\        |     |   |     \\   |         /     |      |     |   /         \\         /" << endl;
    cout << "  *---*   *     *   *      *  *    *---*      *      *     *  *           *   *---*" << endl;
    return 0;
}
// bai 4
#include <iostream>
#include <iomanip>
#include <math.h>
using namespace std;
int main()
{
  double a, b, c, d;
  cout << "Nhap a,b,c,d: ";
  cin >> a >> b >> c >> d;
  double tmp = a;
  a = d;
  d = tmp;
  cout << "Hoan doi gia tri dau va cuoi: " << a << " " << b << " " << c << " " << d << endl;
  cout << " Trung binh cong: " << (a + b + c + d) / 4 << endl;
  return 0;
}
Leave a Comment