Source Code :
#include<iostream>
#include<conio.h>
#include<string.h>
using namespace std;
int main(int argc, char** argv) {
char string[70]; //deklarasi variabel
int jum_karakter;
cout<<"Mengubah Kata ke besar kecil"<<endl;
cout<<"---------------------------------"<<endl;
cout<<"Masukkan String : ";
cin.getline(string, sizeof(string));
for(int i = 0; string[i]; i++)
if(i%2==0) {
strupr(string);
cout<<string[i];
}
else{
strlwr(string);
cout<<string[i];
}
return 0;
}
Hasil output :
#include<iostream>
#include<conio.h>
#include<string.h>
using namespace std;
int main(int argc, char** argv) {
char string[70]; //deklarasi variabel
int jum_karakter;
cout<<"Mengubah Kata ke besar kecil"<<endl;
cout<<"---------------------------------"<<endl;
cout<<"Masukkan String : ";
cin.getline(string, sizeof(string));
for(int i = 0; string[i]; i++)
if(i%2==0) {
strupr(string);
cout<<string[i];
}
else{
strlwr(string);
cout<<string[i];
}
return 0;
}
Hasil output :
Comments
Post a Comment