- #include<iostream>
- using namespace std;
- int main(){
- char x;
- int i;
- cout<<"Menu:A(dd) D(elete) S(ort) Q(uit),Select one:";
- for(;i=1;i++){
- cin>>x;
- if(x=='A'){
- cout<<"数据已增加"<<endl;
- cout<<"Menu:A(dd) D(elete) S(ort) Q(uit),Select one:";
- continue;
- }
- else if(x=='D'){
- cout<<"数据已删除"<<endl;
- cout<<"Menu:A(dd) D(elete) S(ort) Q(uit),Select one:";
- continue;
- }
- else if(x=='S'){
- cout<<"数据已排序"<<endl;
- cout<<"Menu:A(dd) D(elete) S(ort) Q(uit),Select one:";
- continue;
- }
- else if (x=='Q')
- break;
- }
- return 0;
- }
- #include<iostream>
- using namespace std;
- int main(){
- char n;
- cout<<"Menu:A(dd) D(elete) S(or) Q(uit),Select one:";
- cin>>n;
- while(n!='Q')
- {
- switch(n)
- {
- case'A':
- {
- cout<<"数据已经增加"<<endl;break;
- }
- case 'D':
- {
- cout<<"数据已经删除"<<endl;break;
- }
- case'S':
- {
- cout<<"数据已经排序"<<endl;break;
- }
- }
- cin>>n;
- }
- return 0;
- }
- #include<iostream>
- #include<iomanip>
- #include<cmath>
- using namespace std;
- int main(){
- int m,j,i,k=1;
- for(i=2;i<=100;i++){
- m=sqrt(i);
- for(j=2;j<=m;j++){
- if(i%j==0)break;
- }
- if(j>m){
- cout<<setw(5)<<i;
- k++;
- if(k>5){
- cout<<setw(5)<<endl;
- k=1;
- }
- }
- }
- return 0;
- }
- #include<iostream>
- #include<iomanip>
- #include<cmath>
- using namespace std;
- int main(){
- int m,j,i=1,k=1;
- while(i<=100){
- m=sqrt(i);
- for(j=2;j<=m;j++){
- if(i%j==0)break;
- }
- if(j>m&&i!=1){
- cout<<setw(5)<<i;
- k++;
- if(k>5){
- cout<<setw(5)<<endl;
- k=1;
- }
- }
- i++;
- }
- return 0;
- }
- #include<iostream>
- #include<iomanip>
- #include<cmath>
- using namespace std;
- int main(){
- int m,j,i=1,k=1;
- do{
- m=sqrt(i);
- for(j=2;j<=m;j++){
- if(i%j==0)break;
- }
- if(j>m&&i!=1){
- cout<<setw(5)<<i;
- k++;
- if(k>5){
- cout<<setw(5)<<endl;
- k=1;
- }
- }
- i++;
- }while(i<=100);
- return 0;
- }
- #include<iostream>
- #include<cstdlib>
- #include<ctime>
- using namespace std;
- int main(){
- srand((unsigned)time(0));
- int m,n;
- m=rand()%100+1;
- cin>>n;
- while(n!=m){
- if(n>m)
- cout<<"比该数字小";
- cout<<"请再输入"<<endl;
- if(n<m)
- cout<<"比该数字大";
- cout<<"请再输入"<<endl;
- cin>>n;
- }
- cout<<"猜对了";
- return 0;
- }
- #include<iostream>
- #include<cstdlib>
- #include<ctime>
- using namespace std;
- int main(){
- srand((unsigned)time(0));
- int m,n;
- m=rand()%100+1;
- cin>>n;
- do{
- if(n>m)
- cout<<"比该数字小";
- cout<<"请再输入"<<endl;
- if(n<m)
- cout<<"比该数字大";
- cout<<"请再输入"<<endl;
- cin>>n;
- }while(n!=m);
- cout<<"猜对了";
- return 0;
- }
- #include<iostream>
- using namespace std;
- enum Packet{Red,Yellow,Blue,White,Black};
- void change(int n)
- {
- switch(n)
- {
- case 0:cout<<"Red"<<endl;break;
- case 1:cout<<"Yellow"<<endl;break;
- case 2:cout<<"Blue"<<endl;break;
- case 3:cout<<"White"<<endl;break;
- case 4:cout<<"Black"<<endl;break;
- }
- }
- int main()
- {
- int i,j,k,total=0;
- cout<<"The type:\n";
- for(i=Red;i<=Black;i++)
- {
- for(j=Red;j<=Black;j++)
- {
- for(k=Red;k<=Black;k++)
- {
- if(i!=j&&i!=k&&j!=k)
- {
- change(i);
- change(j);
- change(k);
- cout<<endl;
- ++total;
- }
- }
- }
- }
- cout<<"The count:"<<total<<endl;
- return 0;
- }
- #include<iostream>
- using namespace std;
- enum Packet{Red,Yellow,Blue,White,Black};
- void change(int n)
- {
- switch(n)
- {
- case 0:cout<<"Red"<<endl;break;
- case 1:cout<<"Yellow"<<endl;break;
- case 2:cout<<"Blue"<<endl;break;
- case 3:cout<<"White"<<endl;break;
- case 4:cout<<"Black"<<endl;break;
- }
- }
- int main()
- {
- int i,j,k,total=0;
- cout<<"The type:\n";
- for(i=Red;i<=Black;i++)
- {
- for(j=Red+i+1;j<=Black;j++)
- {
- for(k=Red+j+1;k<=Black;k++)
- {
- if(i!=j&&i!=k&&j!=k)
- {
- change(i);
- change(j);
- change(k);
- cout<<endl;
- ++total;
- }
- }
- }
- }
- cout<<"The count:"<<total<<endl;
- return 0;
- }
来源: http://www.bubuko.com/infodetail-2989887.html