This is default featured slide 1 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 2 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 3 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 4 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 5 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

Tampilkan postingan dengan label problem. Tampilkan semua postingan
Tampilkan postingan dengan label problem. Tampilkan semua postingan

Jumat, 06 Mei 2016

PROBLEM SOLVING 538

E-Book (Problem Solving And Program Design in C) = Finding Capital Letters In A String (Halaman 538).

Assalamu’alaikum w.w.,


Pada kesempatan ini saya akan memposting Program dari materi ARRAY , program ini akan dibuat dalam bentuk C++ . Program yang akan di buat yaitu : Tentang : Finding Capital Letters In A String (Halaman 538).


Algoritma :

    1. jika str adalah string kosong

    2. Toko string kosong di topi (string tanpa huruf tidak memiliki ibukota). lain

    3. jika huruf awal dari str adalah huruf kapital

    4. Simpan dalam topi surat ini dan huruf kapital dari sisa str.lain

    5. Simpan dalam topi huruf kapital dari sisa str.


Program C++ yang Menggunakan Aplikasi Dev C++ :

#include <iostream>

#include <string.h>

#include <conio.h>

using namespace std;

int main()

{

int i,jum;


char string[100];


cout<<"Masukan sembarang kalimat:\n";

cin.getline(string,100); //membaca spasi


//mengubah huruf awal menjadi huruf kapital

if((string[0]>='a')&& (string[0]<='z'))

string[0]=(char)string[0]-32;



//mengubah huruf setelah huruf awal menjadi huruf kecil

jum=1;int d=0;

for(i=0;i<(int)strlen(string);i++)

{

    if(i%2==0){

    

if((string[jum]>='A')&& (string[jum]<='Z'))

string[jum]=(char)string[jum]+32;

jum++;}

}


//mengubah huruf setelah spasi menjadi huruf kapital

for(i=1;string[i]!='\0';i++)

{

    if(string[i]==' ') d++;

if((i-1-d)%2==0)

{

if(string[i+1]>='a' && string[i+1]<='z')

string[i+1]=(char)(string[i+1]-32);

}

}



cout<<"Hasil Akhir : "<<string<<endl;

getch();

}


Minggu, 17 April 2016

problem solving 419

assalamualaikum wr.wb

c++ :
#include <iostream>
#include <conio.h>
#include <stdio.h>
#include <string.h>
using namespace std;
int main(int argc, char** argv) {
 int cur_month;
 cout<<"\n 1 = Happy New Year ";
 cout<<"\n 2 = Summer begins  ";
 cout<<"\n 3 = Back to school ";
 cout<<"\n 4 = Happy Holidays ";
 cout<<"\nMasukkan Sebuah Angka :";
 cin>>cur_month;
  if (cur_month == 1){
cout<<"Happy New Year\n";}
else if (cur_month == 2){
cout<<"Summer begins\n";}
else if (cur_month == 3){
cout<<"Back to school\n";
}
else if (cur_month == 4){
 cout<<"Happy Holidays\n";
}
else {
 cout<<"angka yang anda masukkan salah";
}
 return 0;
}



SUBPROGRAM : 
#include <iostream>
#include <conio.h>
#include <string.h>
using namespace std;
void kembali(int cur_month){
if (cur_month == 1){
cout<<"Happy New Year\n";}
else if (cur_month == 2){
cout<<"Summer begins\n";}
else if (cur_month == 3){
cout<<"Back to school\n";
}
else if (cur_month == 4){
 cout<<"Happy Holidays\n";
}
else {
 cout<<"angka yang anda masukkan salah";
}
}
main(){
int cur_month;
cout<<"\n 1 = Happy New Year ";
 cout<<"\n 2 = Summer begins  ";
 cout<<"\n 3 = Back to school ";
 cout<<"\n 4 = Happy Holidays ";
 cout<<"\nMasukkan Sebuah Angka :";
 cin>>cur_month;

}


problem solving 538

assalamualaikum wr.wb

c++ :
#include <iostream>
#include <string.h>
using namespace std;
main(){
char coba[100];
int a;
cout<<"masukkan kata =";
cin>>coba;
cout<<"huruf kapital pada kata tersebut =";
for(int a=0;a<strlen(coba);a++){
if(coba[a]>='A' && coba[a]<='Z')cout<<coba[a];
}
}