Materi String

#include <cstdlib>
#include <iostream>
#include <string.h>

using namespace std;

int main(int argc, char *argv[])
{
char kata[10]=”saya”;
char *kata1 = “suka”;
string kata2 = “Dasar-Dasar Pemrograman”;

cout << kata<<” “<< kata1 <<” “<< kata2 <<endl;
//cout << “Nama saya : “;cin >> kata1;
char s[100]= “saya cinta”;
char s1[100]=”Universitas Ahmad Dahlan”;
cout << “sebelum strcat(s,s1)”<<endl;
cout << “\t s : “<<s<<endl;
cout << “\t s1 : “<<s1<<endl;

strcat(s,s1);
cout << ” sebelum strcpy (s , s1) “<< endl;
cout << “\t s : “<< s << endl;
cout << “\t s1 : “<< s1 << endl;
cout << s << endl;
cout << s1 << endl;

system(“PAUSE”);
return EXIT_SUCCESS;
}

Tinggalkan Balasan

Please log in using one of these methods to post your comment:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s