[ create a new paste ] login | about

Link: http://codepad.org/JHYZQPJ1    [ raw code | output | fork | 2 comments ]

C, pasted on Sep 6:
#include<stdio.h>
#include<conio.h>
int main()
{
	int thang;
	printf("\nNhap thang: ");
	scanf("%d", &thang);
	switch (thang)
	{
	case 1:
	case 2:
	case 3:
		printf("\nQui mot");
		break;
	case 4:
	case 5:
	case 6:
		printf("\nQui hai");
		break;
	case 7:
	case 8:
	case 9:
		printf("\nQui ba");
		break;
	case 10:
	case 11:
	case 12:
		printf("\nQui bon");
		break;
	}
	getch();
	return 0;

}


Output:
1
Line 17: error: conio.h: No such file or directory


Create a new paste based on this one


Comments:
posted by yonnon on Jul 12
#include<bits/stdc++.h>

using namespace std;
int main(){
int n;
do{
cout <<"Enter your sentence: ";
cin >> n;
if(n<=0 || n>12){
cout<<"Nhap sai. Nhap lai!"<<
endl;
}
}while(n<=0 || n>12);
if( n>=1 && n<=3){
cout<<" 1 "<<
endl;
return 0;
}
else if( n>=4 && n<=6){
cout<<" 2 "<<
endl;
return 0;
}

else if( n>=7 && n<=9){
cout<<" 3 "<<
endl;
return 0;
}
else if( n>=10 && n<=12){
cout<<" 4 "<<
endl;
return 0;
}

}
reply
posted by 18103191 on Sep 16
#include <iostream>

using namespace std;
int main(){
int n;
do{
cout << "\nNhap thang: ";
cin >> n;
if(n < 1 || n > 12){
cout << "\nThang khong hop le !";
}else if(n >= 1 && n <= 3){
cout << "\nThang thuoc quy I ";
}else if(n >= 4 && n <= 6){
cout << "\nThang thuoc quy II ";
}else if(n >= 7 && n <= 9){
cout << "\nThang thuoc quy III ";
}else{
cout << "\nThang thuoc quy IV ";
}
}while(n < 1 || n > 12);
return 0;
}
reply