assalamualaikum wr.wb
c++ :
#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;
}
0 komentar:
Posting Komentar