Algoritma Pemrograman
Diktat Bab 7 no 7
Program Ubah Huruf kecil ke Kapital dan Kapital ke Kecil
Koding Program :
#include <stdio.h>
#include <ctype.h>
#include <iostream>
#include <conio.h>
using namespace std;
void nama()
{
int i=0;
char nama[100];
char c;
int a=0;
char entri[100];
char out;
cout<<"Kapital = "; gets(nama);
cout<<"Huruf kecil = ";
while (nama[i])
{
c=nama[i];
if (isupper(c)) c=tolower(c);
putchar (c);
i++;
}cout<<endl<<endl;
cout<<"Huruf Kecil = "; gets(entri);
cout<<"Kapital = ";
while (entri[a])
{
out=entri[a];
if (islower(out)) out=toupper(out);
putchar (out);
a++;
}
}
int main(){
nama();
}
EmoticonEmoticon