#include <cstdlib.h>
# include <iostream.h>
int main(int argc, char*argv[])
{
int n, nilai;
int total=0;
cout<<”Masukkan berapa banyak nilai yang mau dihitung: “;
cin>>n;
for (int i=0; i<n; i++){
cout<<”Masukkan nilai ke”<<i+1<<”: “;
cin>>nilai;
}
cout<< “Jumlah nilai yang dimasukkan=”<<total;
}
ask !!
Make a full program in OOP is have:
1. Class, there is a data member & member funtion
2. Konstruktor
3. I/O operator overloading
4. Use for to change the iterative part become to rekursif part
# include <iostream.h>
int main(int argc, char*argv[])
{
int n, nilai;
int total=0;
cout<<”Masukkan berapa banyak nilai yang mau dihitung: “;
cin>>n;
for (int i=0; i<n; i++){
cout<<”Masukkan nilai ke”<<i+1<<”: “;
cin>>nilai;
}
cout<< “Jumlah nilai yang dimasukkan=”<<total;
}
ask !!
Make a full program in OOP is have:
1. Class, there is a data member & member funtion
2. Konstruktor
3. I/O operator overloading
4. Use for to change the iterative part become to rekursif part
0 komentar:
Posting Komentar