#include <cstdlib>
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
int username,password;
int a;
cout<<"WELCOME IN ATM"<<endl;
cout<<endl;
int user = 0000;
int pass = 1234;
0
komentar
Posted in
Label:
Kuliah
#include <cstdlib>
#include <iostream>
using namespace std;
class hitung
{
public:
void input();
int proses();
private:
int n;
float rumus,jumlah,total;
};
0
komentar
Posted in
Label:
Kuliah
#include <iostream>
#include <string>
using namespace std;
int main (){
int a;
a=1;
while (1)
{
0
komentar
Posted in
Label:
Kuliah
0
komentar
Posted in
Label:
Kuliah
0
komentar
Posted in
Label:
Kuliah
0
komentar
Posted in
Label:
Kuliah
#include <iostream>
#include <string>
using namespace std;
int main()
{
string raptor_prompt_variable_zzyz;
int b, a;
0
komentar
Posted in
Label:
Kuliah
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
int a, b;
cout<<"a\tb"<<endl;
cout<<endl;
for(a=1;a<4;++a){
cout<<"Outer "<<a<<endl;
for(b=0;b<a;++b){
cout<<"Inner "<<b<<endl;
}
}
system("PAUSE");
return EXIT_SUCCESS;
}
Hasilnya :
0
komentar
Posted in
Label:
Kuliah
#include <cstdlib>
#include <iostream>
#define SENTINEL 0
#define NUM_MONTHS 12
using namespace std;
int main(int argc, char *argv[])
{
int m, mem_sight,sightings;
cout<<"BALD EAGLE SIGHTINGS"<<endl;
cout<<endl;
for(m=1;m<=NUM_MONTHS;m++){
sightings=0;
cin>>mem_sight;
while(mem_sight != SENTINEL){
if(mem_sight>=0)
sightings+= mem_sight;
else
cout<<"Warning negative count ingores"<<mem_sight<<endl;
}
cout<<"month = "<<m<<sightings;
}
system("PAUSE");
return EXIT_SUCCESS;
}
Hasilnya
0
komentar
Posted in
Label:
Kuliah
#include <cstdlib>
#include <iostream>
#define sentinel -44
using namespace std;
int main(int argc, char *argv[])
{
int sum=0,score;
cout<<"Enter first score ( or "<<sentinel<<"to quit)>";
cin>>score;
while (score !=sentinel){
sum += score;
cout<<"enter next score("<<sentinel<<"to quit)>";
cin>>score;
}
cout<<"Sum of exam score is "<<sum<<endl;
system("PAUSE");
return EXIT_SUCCESS;
}
Hasilnya :
0
komentar
Posted in
Label:
Kuliah
#include <cstdlib>
#include <iostream>
#define capacity 80000.0
#define min_pct 10
#define gals_per_brl 42.0
double monitor_gas(double min_supplay,double start_supply);
using namespace std;
int main(void)
{
double start_supply, min_supply, current;
min_supply = min_pct/100.0*capacity;
cout<<"Number of barrels currently in tank = ";
cin>>start_supply;
current = monitor_gas(min_supply,start_supply);
cout<<"only barrels are left."<<current<<endl<<endl;
cout<<"*** WARNING ***"<<endl;
cout<<"Available supply is less than percent of"<<min_pct<<"tank's "<<endl;
cout<<capacity<<"barrel capacity."<<endl;
system("PAUSE");
return EXIT_SUCCESS;
}
double monitor_gas(double min_supply, double start_supply)
{
double remov_gals, remov_brls,current;
for (current = start_supply; current >= min_supply; current -= remov_brls){
cout<<"barrels are available."<<current<<endl<<endl;
cout<<"Enter number of gallons removed> ";
cin>>remov_gals;
remov_brls = remov_gals/gals_per_brl;
cout<<"After removal of"<<remov_gals<<" gallone
{"<<remov_brls<<" barrels)"<<endl;
}
return (current);
}
0
komentar
Posted in
Label:
Kuliah
#include <cstdlib>
#include <iostream>
#define cbegin 10
#define climit -5
#define cstep 5
using namespace std;
int main(int argc, char *argv[])
{
int celcius;
double fahrenhait;
cout<<" Celcius \t Fahrenhait"<<endl;
cout<<endl;
for(celcius=cbegin;celcius>=climit;celcius-=cstep){
fahrenhait=1.8*celcius+32.0;
cout<<"celcius "<<celcius<<"\tfahrenhait "<<fahrenhait<<endl;
}
system("PAUSE");
return EXIT_SUCCESS;
}
Hasilnya :
0
komentar
Posted in
Label:
Kuliah
#include <cstdlib>
#include <iostream>
using namespace std;
int faktorial(int a){
int i, produk=1;
for(i=a;i>1;--i){
produk=produk*i;
}
return produk;
}
int main(int argc, char *argv[])
{
int a;
cout<<"masukkan nilai = ";cin>>a;
cout<<faktorial(a);
cout<<endl;
system("PAUSE");
return EXIT_SUCCESS;
}
Hasilnya :
0
komentar
Posted in
Label:
Kuliah
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
int a=0, b;
float rate,pay, total_pay=0.0, hours;
cout<<"enter number of employees = ";cin>>b;
for(a=0;a<b;a+=1){
cout<<"Hours = ";cin>>hours;
cout<<"Rate = ";cin>>rate;
pay=hours*rate;
cout<<"Pay is = $ "<<pay<<endl;
a=a+1;
}
cout<<"All employees processed"<<endl;
cout<<"Total payroll is "<<total_pay<<endl;
system("PAUSE");
return EXIT_SUCCESS;
}
Hasilnya :