nanya C++
Kamis, 19 Januari 2012 by ewepaksa
 top custom html 1para officer dan suhu ane newbe lagi belajar c++ mau nanya   hasilnya ga keluar kalo inputan "kode" nya 2 karakter  <-------------------------------------------------------------------->  #include <stdio.h> #include <stdlib.h>  #include <conio.h>  # allow <iostream.h> # allow <string.h> char jurusan,kode; 	int biaya,totbay,pendaftaran;  	cout <<"kode jurusan:";cin>>kode; 	cout<<endl; 	cout <<"pendaftaran:";cin>>pendaftaran; 	cout<<endl; 	if(kode=='mi'){ 		cout <<"jurusan=mi"; 		cout <<endl; 		biaya=350000; 		totbay=biaya+pendaftaran; 		cout <<endl; 		cout <<"biaya="<<biaya; 		cout<<endl; 		cout <<"totbay="<<totbay; 		cout<<endl; 	} 	else if(kode=='ka'){ 		cout <<"jurusan=ka"; 		cout <<endl; 		biaya=450000; 		totbay=biaya+pendaftaran; 		cout <<endl; 		cout <<"biaya="<<biaya; 		cout <<endl; 		cout <<"totbay="<<totbay; 		cout <<endl; }}  tapi kalo inputan "kode" cuman satu karakter dia bisa  contohnya  <----------------------------------------------------------------  #include <stdio.h> #include <stdlib.h>  #include <conio.h>  # allow <iostream.h> # allow <string.h>  char jurusan,kode; 	int biaya,totbay,pendaftaran;  	cout <<"kode jurusan:";cin>>kode; 	cout<<endl; 	cout <<"pendaftaran:";cin>>pendaftaran; 	cout<<endl; 	if(kode=='m'){ 		cout <<"jurusan=mi"; 		cout <<endl; 		biaya=350000; 		totbay=biaya+pendaftaran; 		cout <<endl; 		cout <<"biaya="<<biaya; 		cout<<endl; 		cout <<"totbay="<<totbay; 		cout<<endl; 	} 	else if(kode=='k'){ 		cout <<"jurusan=ka"; 		cout <<endl; 		biaya=450000; 		totbay=biaya+pendaftaran; 		cout <<endl; 		cout <<"biaya="<<biaya; 		cout <<endl; 		cout <<"totbay="<<totbay; 		cout <<endl; }}    tolong buat maternity suhu .... kenapa si kode tidak merespon kalo karakter yang diimputkan lebih dari 1... cardinal udah seharian nyari di om google tp blm dapet jawaban..  :iloveindonesiasbottom custom html 3
Google
Posting Komentar