Bài tập C++ //2
In ra so da nhap lon nhat tren ban phim
#include
#include
#include
using namespace std;
int main()
{
int N, i;
float s, M=0;
cout
cin>>N; cout
for(i=1;i
{cout
cin>>s;
if(M
cout
system("pause");
return 0;
}
Nhap ten HS theo thu tu ABC
#include
#include
using namespace std;
int main ()
{
string S1, S2, S3;
getline(cin,S1);
getline(cin,S2);
getline(cin,S3);
if(S1
{ if(S2
cout
else {if(S1=S3
else cout
}
else {if(S2>=S3) //S1 > S2
cout
else {if(S1>=S3) cout
else cout
}
system("pause");
return 0;
}
Nhap N so thuc
#include
#include
using namespace std;
int main ()
{
int i, N;
float r;
cout
cin >> N;
cout
cin >> r;
system("pause");
return 0;
}
Sap xep theo thu tu tang dan
#include
#include
#include
using namespace std;
int main()
{
int a,b,c;
cout
cin>>a>>b>>c;
if (a>b)
if (b>c)
cout
else
if (a>c)
cout
else cout
else
if (b
cout
else
if (a
cout
else cout
system("pause");
return 0;
}
So nguyen to nho hon N
#include
#include
using namespace std;
int main ()
{
int i, N, S, K=0;
cout
cin >> N;
for(i=1;i
{if(N%i==0)
S=(N%i==0);
K= K + S;
if((S=1))
cout
system("pause");
return 0;
}
Sap xep so thuc
#include
#include
using namespace std;
int main ()
{
float a, b, c;
cin >> a >> b >> c;
cout.precision(2);
cout.setf(ios::fixed);
if(a
{ if(b
cout
else {if(a
else cout
}
else {if(b>=c)
cout
else {if(a>=c) cout
else cout
}
system("Pause");
return 0;
}
Bạn đang đọc truyện trên: Truyen247.Pro