Program bentuk tabel
#include <iostream>
using namespace std;
int main ( )
{
float a,b,c,d,e,f,total;
cout<<"Masukan nilai a :";
cin>> a;
cout<<endl;
cout<<"Masukan nilai b :";
cin>> b;
cout<<endl;
c= a+b;
d= a*b;
e= a/b;
f= a-b;
total = c+d+e+f;
cout<<"___________________"<<endl;
cout<<"| A\t| B\t| A+B\t| AxB\t| A:B\t| A-B\t| Total\t|"<<endl;
cout<<"~~~~~~~~~~~~~~~~~~~"<<endl;
cout<<"| \t| \t| \t| \t| \t| \t| \t|"<<endl;
cout<<"| "<<a<<"\t| "<<b<<"\t| "<<c<<"\t| "<<d<<"\t| "<<e<<"\t| "<<f<<"\t| "<<total<<"\t|"<<endl;
cout<<"| \t| \t| \t| \t| \t| \t| \t|"<<endl;
cout<<"~~~~~~~~~~~~~~~~~~~"<<endl;
}
using namespace std;
int main ( )
{
float a,b,c,d,e,f,total;
cout<<"Masukan nilai a :";
cin>> a;
cout<<endl;
cout<<"Masukan nilai b :";
cin>> b;
cout<<endl;
c= a+b;
d= a*b;
e= a/b;
f= a-b;
total = c+d+e+f;
cout<<"___________________"<<endl;
cout<<"| A\t| B\t| A+B\t| AxB\t| A:B\t| A-B\t| Total\t|"<<endl;
cout<<"~~~~~~~~~~~~~~~~~~~"<<endl;
cout<<"| \t| \t| \t| \t| \t| \t| \t|"<<endl;
cout<<"| "<<a<<"\t| "<<b<<"\t| "<<c<<"\t| "<<d<<"\t| "<<e<<"\t| "<<f<<"\t| "<<total<<"\t|"<<endl;
cout<<"| \t| \t| \t| \t| \t| \t| \t|"<<endl;
cout<<"~~~~~~~~~~~~~~~~~~~"<<endl;
}

Komentar
Posting Komentar