switchca.cpp

Bookmark and Share
#include<iostream.h>

main ()

{

char jawab, Y,y ;

 cout<<"Ibukota Indonesia adalah.....\n";

 cout<<"A. Ambon\n";

 cout<<"B. Bandung\n";

 cout<<"C. Jakarta\n";

 cout<<"D. Surabaya\n";

 cout<<"Pilihan Anda : " ;

 cin>>jawab;

 switch (jawab)

 {    case 'A' :    case 'a' :cout<<jawab<<" ???\nSALAH!!!\n"; break ;

    case 'B' :    case 'b' :cout<<jawab<<" ???\nSALAH!!!\n"; break ;

    case 'C' :    case 'c' :cout<<jawab<<" ???\nBenar!!!\n"; break ;

    case 'D' :    case 'd' :cout<<jawab<<" ???\nSALAH!!!\n"; break ;

    default     :    cout<<jawab<<"???\nAnda salah ketik, Masukkan huruf A/B/C/D!\n" ;

 }

 return 0;

}

{ 0 komentar... Views All / Send Comment! }

Posting Komentar

Powered By Blogger