標題:
這個陣列圖,哪裡錯了?
[打印本頁]
作者:
may
時間:
2023-5-26 11:58
標題:
這個陣列圖,哪裡錯了?
[attach]15703[/attach]
請將這個陣列正確的宣告出來
string bird[8]={ , , , , , , , };
作者:
張絜晰
時間:
2023-5-26 21:08
小靖和小橘跟小白住在不同的房子內,所以不能都用"麻雀[0]"
作者:
蔡沛倢
時間:
2023-5-27 14:22
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
string bird[8]={"小白","小黃","小綠","小紅","小紫","小澄","小靖","小橘"};
int number[8]={0,1,2,3,4,5,6,7};
cout<<"姓名\t編號"<<endl;
for(int i=0;i<=7;i++)
{
cout<<bird[i]<<"\t"<<number[i]<<endl;
}
system("pause");
return 0;
}
複製代碼
作者:
呂宗晉
時間:
2023-6-2 14:39
#include<iostream>
#include<cstdlib>
using namespace std;
int main(){
string birds[]={"小白","小黃","小綠","小紅","小紫","小橙","小靖","小橘"};
// cout<<birds[0]<<endl;
// cout<<birds[1]<<endl;
// cout<<birds[5]<<endl;
for(int i=0;i<=7;i++)
{
cout<<"第"<<i+1<<"隻"<<birds[i]<<endl;
}
system("pause");
return 0;
}
複製代碼
作者:
呂得銓
時間:
2023-6-2 17:31
#include<iostream>
#include<cstdlib>
using namespace std;
int main(){
string birds[]={"小白","小黃","小綠","小紅","小紫","小橙","小靖","小橘"};
for(int i=0;i<=7;i++)
{
cout<<"第"<<i+1<<"隻"<<birds[i]<<endl;
}
system("pause");
return 0;
}
複製代碼
歡迎光臨 種子論壇 | 高雄市資訊培育協會學員討論區 (http://istak.org.tw/seed/)
Powered by Discuz! 7.2