Jumat, 13 November 2009

tugas CPP minggu ini Q 5



#include "iostream.h"

void main(){
int input;
cout<<"Input the length of number : "; cin>>input;
if((input>0)&&(input<=10)){
cout<<" X ";
for(int a=1;a<=input;a++){
cout<<"\t"<
}cout<<"\n\n";
for(int ab=1;ab<=input;ab++){
cout<<" "<
for(int b=1;b<=input;b++){
cout<<"\t"<
}cout<<"\n\n";
}
}else
cout<<"please input the integer between 1-10 !!!"<
}

tugas CPP minggu ini Q 4




#include "iostream.h"

void main(){

int old,oldMin,mins,input,maks,loop;
double Avg,Sum;
loop=0;
Sum=0;
old=0;
oldMin=0;
do{
cout<<"input number : "; cin>>input;
if(input==0)
break;

if(oldinput){
mins=input;
}else{
mins=oldMin;
} oldMin=mins;

loop++;
}while(input!=0);
Avg=Sum/loop;

cout<<"the Smallest input : "<<
cout<<"The Largest input : "<<
cout<<"the Average is : "<<

}

tugas CPP minggu ini Q 2





#include "iostream.h"

void main(){
int mark1,mark2,mark3,pass;
double TotalMark,Avg;
char avgMark;
pass=0;

cout<<"Input Mark1 : "; cin>>mark1;
cout<<"Input Mark2 : "; cin>>mark2;
cout<<"Input Mark3 : "; cin>>mark3;

TotalMark=mark1+mark2+mark3;
Avg=TotalMark/3;

if(mark1>40)
pass++;
if(mark2>40)
pass++;
if(mark3>40)
pass++;

switch(pass){
case 0:
case 1:
cout<<"Failed"<<50) else="" cout=""><<"You Pass this exams"<<<"You Pass this exams"<<<"Your Total Mark is :"<<<<"Your Percentage Mark is "<<<" %"<85)
avgMark='A';
else if((Avg<=85)&&(Avg>75))
avgMark='B';
else if((Avg<=75)&&(Avg>65))
avgMark='C';
else if((Avg<65)&&(avg>55))
avgMark='D';
else if((Avg<=55)&&(Avg>45))
avgMark='E';
else
avgMark='F';
cout<<"Your Average Mark is : "<<
}

tugas CPP minggu ini Q 1



#include "iostream.h"

void main(){
int mark1,mark2,mark3,pass;
double TotalMark,Avg;
pass=0;

cout<<"Input Mark1 : "; cin>>mark1;
cout<<"Input Mark2 : "; cin>>mark2;
cout<<"Input Mark3 : "; cin>>mark3;

TotalMark=mark1+mark2+mark3;
Avg=TotalMark/3;

if(mark1>40)
pass++;
if(mark2>40)
pass++;
if(mark3>40)
pass++;

if(pass<2)>
else if(pass==2){
if(Avg<50)>
else
cout<<"You Pass this exams"<
}else
cout<<"You Pass this exams"<
cout<<"Your Total Mark is :"<<
cout<<"Your Percentage Mark is "<<<" %"<
}


###############################################

Sabtu, 07 November 2009

Tugas CPP

#include "stdio.h"

void main(){
int r,t;
double L,V,keliling,luasalas;

printf("## Tube ## \n");
printf("input jari-jari (r) : ");
scanf("%d",&r);
printf("input tinggi (t) : ");
scanf("%d",&t);

keliling=2*3.14*r;
luasalas=3.14*r*r;

V=luasalas*t;
L=(2*luasalas)+(keliling*t);

printf("Volume : %f \n",V);
printf("Luas permukaan : %f \n",L);

}

click here to download