#include <iostream>
#include <iomanip>
using namespace std;
int main()
{ cout<<"........................."<<endl; cout << "Hello !" << endl; cout <<"Welcome to c++!"<<endl; cout<<"........................."<<endl; getchar(); cout<<"Which task would you like to do?"<<endl; cout<<"11"<<endl; int x; cin>>x; switch(x) { case 1: { float a=0.00000678f; double b=0.00000678; a=a+111111.111f; b=b+111111.111; cout<<setiosflags(ios::fixed)<<setprecision(16); cout<<"a="<<a<<",b="<<b<<endl; break; } case 2: { cout<<"abc\tde\rf\tg"<<endl; cout<<"h\ti\b\bjk\n123\'\"\\\x41\102CDE"<<endl; break; } }
}
不知道為啥輸完選項就跳出去不運行了!
uj5u.com熱心網友回復:
整理樓上代碼,試運行,結果在最后,沒發現樓主的問題:#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
cout<<"........................."<<endl;
cout << "Hello !" << endl;
cout <<"Welcome to c++!"<<endl;
cout<<"........................."<<endl;
getchar();
cout<<"Which task would you like to do?"<<endl;
cout<<"11"<<endl;
int x;
cin>>x;
switch(x) {
case 1:{
float a=0.00000678f;
double b=0.00000678;
a=a+111111.111f;
b=b+111111.111;
cout<<setiosflags(ios::fixed)<<setprecision(16);
cout<<"a="<<a<<",b="<<b<<endl;
break;
}
case 2:{
cout<<"abc\tde\rf\tg"<<endl;
cout<<"h\ti\b\bjk\n123\'\"\\\x41\102CDE"<<endl;
break;
}
}
return 0;
}
//.........................
//Hello !
//Welcome to c++!
//.........................
//3
//Which task would you like to do?
//11
//2
//f ge
//h jk
//123'"\ABCDE
//請按任意鍵繼續. . .
//.........................
//Hello !
//Welcome to c++!
//.........................
//1
//Which task would you like to do?
//11
//1
//a=111111.1093750000000000,b=111111.1110067800037000
//請按任意鍵繼續. . .
uj5u.com熱心網友回復:
int main()
{
cout<<"........................."<<endl;
cout << "Hello !" << endl;
cout <<"Welcome to c++!"<<endl;
cout<<"........................."<<endl;
getchar();
cout<<"Which task would you like to do?"<<endl;
cout<<"11"<<endl;
int x;
cin>>x;
switch(x) {
case 1: {
float a=0.00000678f;
double b=0.00000678;
a=a+111111.111f;
b=b+111111.111;
cout<<setiosflags(ios::fixed)<<setprecision(16);
cout<<"a="<<a<<",b="<<b<<endl;
break;
}
case 2: {
cout<<"abc\tde\rf\tg"<<endl;
cout<<"h\ti\b\bjk\n123\'\"\\\x41\102CDE"<<endl;
break;
}
}
}
uj5u.com熱心網友回復:
奇怪[face]monkey2:006.png[/face]轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/267531.html
標籤:新手樂園
上一篇:求解一個16進制高難度校驗演算法
下一篇:匯編給地址賦值
