cout << "hello 28tech" << endl; // Hiển thị dòng hello 28tech lên màn hình và xuống dòng
cout << 100 << endl; // Hiển thị số 100 lên màn hình và xuống dòng
cout << banKinh << endl; // Hiển thị giá trị của biến banKinh lên màn hình
#include <iostream>
using namespace std;
int main(){
cout << "28tech blog" << endl;
cout << "28tech.com.vn" << " " << "C++ programming !" << endl;
cout << 100 << " " << 200 << " " << 300 << endl;
int n = 282828;
cout << "Gia tri cua bien n : " << n << endl;
return 0;
}
28tech blog
28tech.com.vn C++ programming !
100 200 300
Gia tri cua bien n : 282828
#include <iostream>
using namespace std;
int main(){
bool check = true;
bool used = false;
cout << check << " " << used << endl;
cout << boolalpha << check << endl;
cout << boolalpha << used << endl;
return 0;
}
1 0
true
false
#include <iostream>
#include <iomanip>
using namespace std;
int main(){
float a = 30.192387;
double b = 9.18293;
cout << fixed << setprecision(2) << a << endl;
cout << fixed << setprecision(10) << b << endl;
return 0;
}
30.19
9.1829300000
#include <iostream>
#include <iomanip>
using namespace std;
int main(){
int n = 12345;
cout << setw(10) << n << endl;
cout << setw(10) << setfill('0') << n << endl;
cout << setw(10) << setfill('#') << "28tech" << endl;
return 0;
}
12345
0000012345
####28tech
cin >> a; // Nhập giá trị cho a từ bàn phím
cin >> x >> y >> z; // Nhập giá trị cho 3 biến x, y, z lần lượt từ bàn phím
#include <iostream>
#include <iomanip>
using namespace std;
int main(){
int n, a, b, c;
cout << "Nhap gia tri cho n : ";
cin >> n;
cout << "Gia tri n vua nhap la : " << n << endl;
cout << "Nhap gia tri cho a, b, c : ";
cin >> a >> b >> c;
cout << "Gia tri a, b, c : " << a << " " << b << " " << c << endl;
return 0;
}
Tác giả bài viết: Thanh Sơn
Nguồn tin: blog.28tech.com.vn
Ý kiến bạn đọc
Những tin mới hơn
Những tin cũ hơn