CONTOH OPERASI STRING C++
#include <iostream>
#include <string>
using namespace std;
int main(){
string text1("nama");
cout << "sorting[0]: " << text1[0] << endl;
cout << "sorting[1]: " << text1[1] << endl;
cout << "sorting[2]: " << text1[2] << endl;
cout << "sorting[3]: " << text1[3] << endl;
text1[3] = 'e';
cout << text1 << endl;
string text2(text1 + " lo"); cout << text2 << endl;
string text3(text2 + " siapa?");
text2.append(text3);
cout << text3 << endl;
string text4(" woiiiiii!!!");
text3 += text4;
cout << text3 << endl;
}
menggunakan file header string
Ditulis Oleh : ./DenisGans
Belum ada Komentar untuk "CONTOH OPERASI STRING C++"
Posting Komentar