Cara menggabungkan kalimat :
#include<iostream.h>
#include<string.h>
void main()
{
char k1[50], k2[50];
int p, p1, p2;
cout<<"Kalimat 1 : ";
cin.getline(k1,50);
cout<<"Kalimat 2 : ";
cin.getline(k2,50);
cout<<endl;
cout<<"Di Gabung : "<<strcat(k1,k2)<<endl;
p1=strlen(k1);
p2=strlen(k2);
}
Output :
Pointer
// my first pointer
#include <iostream>
using namespace std;
int main ()
{
int firstvalue, secondvalue;
int * mypointer;
mypointer = &firstvalue;
*mypointer = 10;
mypointer = &secondvalue;
*mypointer = 20;
cout << "firstvalue is " << firstvalue << endl;
cout << "secondvalue is " << secondvalue << endl;
return 0;
}
Output :
Tidak ada komentar:
Posting Komentar