Selamat Datang Di Blogg Saya

Jumat, 15 Oktober 2010

Fungsi string strcpy

list program


#include <cstdlib>
#include <iostream>
#include <string.h>
using namespace std;

int main(int argc, char *argv[])
{
    int i;
    char s1[] = "ABCDEF";
    char s2[] = "XYZ";
    cout<<"sebelum strcpy(s1,s2) :\n";
    cout<<"\tS1 = ["<<s1<<"], panjang = "<<strlen(s1)<<endl;
    cout<<"\ts2 = ["<<s2<<"], panjang = "<<strlen(s2)<<endl;
    strcpy(s1,s2);
    cout<<"setelah strcpy(s1,s2) : \n";
    cout<<"\ts1 = ["<<s1<<"], panjang = "<<strlen(s1)<<endl;
    cout<<"\ts2 = ["<<s2<<"], panjang = "<<strlen(s2)<<endl;
    cin>>i ;
   
    system("PAUSE");
    return EXIT_SUCCESS;
}
out put 


0 comments:

Posting Komentar