Wawan

Friday, July 20, 2012

Contoh Program sederhana Pointer


#include<constream.h>
void main()
{
clrscr();
char *nama = "UNIVERSITAS";
char cari = 'S', tmp;

cout<<"Kata = "<<nama;
cout<<"\nHuruf yang dicari adalah = "<<cari<<endl<<endl;
for(int i=0; i<11; i++){
if(nama[i]==cari)
tmp=nama[i];
//cout<<nama[i]<<" TRUE\n";
//else cout<<nama[i]<<" FALSE\n";
}
if(tmp==cari)
cout<<"Huruf Ditemukan";
else
cout<<"Huruf tidak Ditemukan";
getch();
}

No comments:

Post a Comment