Today, I'm going to share some program that I have used for preparing my 'UTS' or Mid Semester :)
Hm, I know that I'm not clever for this lesson, so don't be panic to see it LOL :))
This is about Function .
Did you know Function guys ??
These are the Program :
The output is :
If you choose number 1, that's mean that you call 1. It's like a calculator. But there's only for 'plus'. How about 'times'? Just explore the program guys :)
Then, this is String :
#include<iostream.h>
#include<string.h>
void karakter();
void balik();
void ubah();
char pil;
char nama[10];
void main()
{
cout<<"Masukkan Nama : ";cin.getline(nama,35);
cout<<"\nMenu : [1]/[2]/[3] ";
cout<<"\n1. Hitung Jumlah Karakter";
cout<<"\n2. Balik Nama";
cout<<"\n3. Rubah Karakter"<<endl;
cin>>pil;
if(pil=='1')
{karakter();}
else if (pil=='2')
{balik();}
else if (pil=='3')
{ubah();}
}
void karakter()
{
cout<<endl<<strlen(nama)<<" karakter";
}
void balik()
{
strrev(nama);
cout<<endl<<nama;
}
void ubah()
{
strupr(nama);
cout<<nama<<" "<<endl;
}
#include<string.h>
void karakter();
void balik();
void ubah();
char pil;
char nama[10];
void main()
{
cout<<"Masukkan Nama : ";cin.getline(nama,35);
cout<<"\nMenu : [1]/[2]/[3] ";
cout<<"\n1. Hitung Jumlah Karakter";
cout<<"\n2. Balik Nama";
cout<<"\n3. Rubah Karakter"<<endl;
cin>>pil;
if(pil=='1')
{karakter();}
else if (pil=='2')
{balik();}
else if (pil=='3')
{ubah();}
}
void karakter()
{
cout<<endl<<strlen(nama)<<" karakter";
}
void balik()
{
strrev(nama);
cout<<endl<<nama;
}
void ubah()
{
strupr(nama);
cout<<nama<<" "<<endl;
}
This is the Output :
First, users could write their name in 'Masukkan Nama', then Enter. After that, some menu will appear. Choose one of that, for example 1. Hitung Jumlah Karakter. This menu will appear how many character of your name.
I think that all guys :)
I have to go to my collage.
See you later :):)
0 comments:
Post a Comment