標題:
宣告字串 (二)
[打印本頁]
作者:
tonyh
時間:
2013-10-12 17:09
標題:
宣告字串 (二)
兩種方式:
1. 字元陣列
2. 字串變數
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
char str1[]="My name is Tony!";
string str2="I come from Taiwan!";
cout<<str1<<endl;
cout<<str2<<endl;
system("pause");
return 0;
}
複製代碼
作者:
施伯叡
時間:
2013-10-12 17:11
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
char str1 [] = "My name is boray";
string str2 = "I come from Taiwan";
cout << str1 <<endl;
cout << str2 <<endl;
system("pause");
return 0;
}
複製代碼
作者:
張峻瑋
時間:
2013-10-12 17:13
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
char str1[]="my name is 張峻瑋!!";
string str2="I come from Taiwan!!";
cout<<str1<<endl;
cout<<str2<<endl;
system ("pause");
return 0;
}
複製代碼
作者:
張彥承
時間:
2013-10-12 17:14
#include<iostream>
#include<cstdlib>
using namespace std;
int main ()
{
char str1[]="My name is Kevin.Legend.Knight";
string str2="I come from Taiwan";
cout<<str1<<endl;
cout<<str2<<endl;
system("pause");
return 0;
}
複製代碼
作者:
張郁偵
時間:
2013-10-12 17:16
#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
char str1 [] = "My name is Jennifer !";
string str2 = "I come from Taiwan!";
cout << str1 << endl;
cout << str2 << endl;
system ("pause");
return 0;
}
複製代碼
作者:
周雍程
時間:
2013-10-12 17:17
#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
char str1[] = "my name is David !";
string str2 = "I come from Taiwan !";
cout<< str1 << endl;
cout<< str2 << endl;
system("pause");
return 0;
}
複製代碼
作者:
張郁庭
時間:
2013-10-12 17:18
#include<iostream>
#include<cstdlib>
using namespace std;
int main ()
{
char str1 [] = "Myname is Chang yu Ting!";
string str2 = "I come from Taiwan!";
cout << str1 << endl;
cout << str2 << endl;
system ("pause");
return 0;
}
複製代碼
歡迎光臨 種子論壇 | 高雄市資訊培育協會學員討論區 (http://seed.istak.org.tw/)
Powered by Discuz! 7.2