返回列表 發帖
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {   
  6.     char n1[5]="Tony";
  7.     cout<<n1<<endl;
  8.     system("pause");
  9.     return 0;   
  10. }
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {   
  6.     char n2[4]={'T','o','n','y'};
  7.     for(int i=0; i<4; i++)
  8.     {
  9.         cout<<n2[i];
  10.     }
  11.     cout<<endl;
  12.     system("pause");
  13.     return 0;   
  14. }
複製代碼

TOP

本帖最後由 高昀昊 於 2022-1-15 10:47 編輯
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {   
  6.     string n3[2]={"To","ny"};
  7.     for(int i=0; i<2; i++)
  8.     {   
  9.         cout<<n3[i];
  10.     }
  11.     cout<<endl;
  12.     system("pause");
  13.     return 0;   
  14. }
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {   
  6.     string n4="Tony";
  7.     cout<<n4<<endl;
  8.     system("pause");
  9.     return 0;   
  10. }
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {   
  6.     int a=3;
  7.     cout<<a<<endl;
  8.     system("pause");
  9.     return 0;   
  10. }
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {   
  6.     char c='P';
  7.     cout<<c<<endl;
  8.     system("pause");
  9.     return 0;   
  10. }
複製代碼

TOP

返回列表