Program Untuk Menghitung Panjang Kata
# include <stdio.h>
# include <conio.h>
# include <iostream.h>
main ()
{
char huruf [80];
char pindah [80];
clrscr ();
cout << "masukkan kata = "; gets(huruf);
cout << "\npanjang kata yang di input = ";
cout << strlen(huruf);
getche();
}
Output:
Program Untuk Membalikan Kata
# include <stdio.h>
# include <conio.h>
# include <iostream.h>
main ()
{
char kata [30];
clrscr ();
cout << "masukkan kata = "; gets(kata);
cout << "\nHasil Perubahan = "<< strrev(kata);
getche();
}
____________________________________________________________
Program Untuk Menggabungkan 2 Buah String
# include <stdio.h>
# include <conio.h>
# include <iostream.h>
main ()
{
char kata1 [30];
char kata2 [30];
clrscr ();
cout << " Masukkan kata = "; gets(kata1);
cout << " Masukkan kata = "; gets(kata2);
strcat(kata1, kata2);
cout << "\nkata penggabungan = " <<kata1;
getche();
}
No comments:
Post a Comment