#include <cstdlib>
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
char kata1[100],kata2[100];
cout<<"Fungsi strlen"<<endl;
cout<<" Masukkan kata: ";
cin.getline(kata1,sizeof(kata1));
cout<<" Hasil: "<<strlen(kata1)<<endl;
cout<<endl;
cout<<"Fungsi strupr"<<endl;
cout<<" Masukkan Kata: ";
cin.getline(kata1,sizeof(kata1));
cout<<" Hasil: "<<strupr(kata1)<<endl;
cout<<endl;
cout<<"Fungsi strlwr"<<endl;
cout<<" Masukkan huruf kapital: ";
cin.getline(kata1,sizeof(kata1));
cout<<" Hasil: "<<strlwr(kata1)<<endl;
cout<<endl;
cout<<"Fungsi strcpy"<<endl;
cout<<" Masukkan Kata: ";
cin.getline(kata1,sizeof(kata1));
cout<<" Masukkan kata yang akan dicopy: ";
cin.getline(kata2,sizeof(kata2));
cout<<" Hasil: "<<strcpy(kata1,kata2)<<endl;
cout<<endl;
cout<<"Fungsi strcat"<<endl;
cout<<"masukkan kata: ";
cin.getline(kata1,sizeof(kata1));
cout<<" Masukkan kata yang akan ditambahkan: ";
cin.getline(kata2,sizeof(kata2));
cout<<" Hasil: "<<strcat(kata1,kata2)<<endl;
cout<<endl;
cout<<"Fungsi strrev"<<endl;
cout<<" Masukkan kata: ";
cin.getline(kata1,sizeof(kata1));
cout<<" Hasil: "<<strrev(kata1)<<endl;
cout<<endl;
cout<<"Fungsi strcmp"<<endl;
cout<<" inputan pertama: ";
cin.getline(kata1,sizeof(kata1));
cout<<" inputan kedua: ";
cin.getline(kata2,sizeof(kata2));
cout<<" Hasil: "<<strcmp(kata2,kata1)<<endl;
cout<<endl;
cout<<"Fungsi strstr"<<endl;
cout<<" Masukkan kata: ";
cin.getline(kata1,sizeof(kata1));
cout<<" Masukkan kata yang dicari: ";
cin.getline(kata2,sizeof(kata2));
cout<<" Hasil: "<<strstr(kata1,kata2)<<endl;
cout<<endl;
cout<<endl;
system("PAUSE");
return EXIT_SUCCESS;
}
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
char kata1[100],kata2[100];
cout<<"Fungsi strlen"<<endl;
cout<<" Masukkan kata: ";
cin.getline(kata1,sizeof(kata1));
cout<<" Hasil: "<<strlen(kata1)<<endl;
cout<<endl;
cout<<"Fungsi strupr"<<endl;
cout<<" Masukkan Kata: ";
cin.getline(kata1,sizeof(kata1));
cout<<" Hasil: "<<strupr(kata1)<<endl;
cout<<endl;
cout<<"Fungsi strlwr"<<endl;
cout<<" Masukkan huruf kapital: ";
cin.getline(kata1,sizeof(kata1));
cout<<" Hasil: "<<strlwr(kata1)<<endl;
cout<<endl;
cout<<"Fungsi strcpy"<<endl;
cout<<" Masukkan Kata: ";
cin.getline(kata1,sizeof(kata1));
cout<<" Masukkan kata yang akan dicopy: ";
cin.getline(kata2,sizeof(kata2));
cout<<" Hasil: "<<strcpy(kata1,kata2)<<endl;
cout<<endl;
cout<<"Fungsi strcat"<<endl;
cout<<"masukkan kata: ";
cin.getline(kata1,sizeof(kata1));
cout<<" Masukkan kata yang akan ditambahkan: ";
cin.getline(kata2,sizeof(kata2));
cout<<" Hasil: "<<strcat(kata1,kata2)<<endl;
cout<<endl;
cout<<"Fungsi strrev"<<endl;
cout<<" Masukkan kata: ";
cin.getline(kata1,sizeof(kata1));
cout<<" Hasil: "<<strrev(kata1)<<endl;
cout<<endl;
cout<<"Fungsi strcmp"<<endl;
cout<<" inputan pertama: ";
cin.getline(kata1,sizeof(kata1));
cout<<" inputan kedua: ";
cin.getline(kata2,sizeof(kata2));
cout<<" Hasil: "<<strcmp(kata2,kata1)<<endl;
cout<<endl;
cout<<"Fungsi strstr"<<endl;
cout<<" Masukkan kata: ";
cin.getline(kata1,sizeof(kata1));
cout<<" Masukkan kata yang dicari: ";
cin.getline(kata2,sizeof(kata2));
cout<<" Hasil: "<<strstr(kata1,kata2)<<endl;
cout<<endl;
cout<<endl;
system("PAUSE");
return EXIT_SUCCESS;
}