- struct merupakan tipe data yang menyimpanan beberapa data dengan default public.
- class merupakan tipe data defaultnya itu private, jadi jika objek anggota dari class itu sendiri ingin dipublikasikan, maka harus menggunakan public
programmubarok
Minggu, 18 September 2016
pertemuan minggu ke-2
refleksi minggunke-2
apa yang telah anda peroleh dari pertemuan minggu ke-2 ?
1. memperoleh tentang pengetahuan class.
2. memperoleh tentang pengetahuan struct.
apa yang belom benar-benar anda pahami pada pertemuan minggu ke-2 ?
- tentang pengetahuan struct ?
apa yang telah anda peroleh dari pertemuan minggu ke-2 ?
1. memperoleh tentang pengetahuan class.
2. memperoleh tentang pengetahuan struct.
apa yang belom benar-benar anda pahami pada pertemuan minggu ke-2 ?
- tentang pengetahuan struct ?
Rabu, 14 September 2016
program 1.6 reference parameter
#include <iostream>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;
template<class Ta,class Tb,class Tc>
Ta abc(const Ta &a, const Tb &b, const Tc &c){
return a+b+b*c+(a+b-c)/(a+b)+4;
}
main(){
cout<<abc(2.,3,4)<<endl; // bisa ditambah titk di salah satu krna ada class Ta ,dst
}
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;
template<class Ta,class Tb,class Tc>
Ta abc(const Ta &a, const Tb &b, const Tc &c){
return a+b+b*c+(a+b-c)/(a+b)+4;
}
main(){
cout<<abc(2.,3,4)<<endl; // bisa ditambah titk di salah satu krna ada class Ta ,dst
}
program 1.5 reference parameter
#include <iostream>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;
template<class T>
T abc(const T &a, const T &b, const T &c){
return a+b+b*c+(a+b-c)/(a+b)+4;
}
main(){
cout<<abc(2,3,4)<<endl;
}
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;
template<class T>
T abc(const T &a, const T &b, const T &c){
return a+b+b*c+(a+b-c)/(a+b)+4;
}
main(){
cout<<abc(2,3,4)<<endl;
}
program 1.4. reference parameter
#include <iostream>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;
template<class T>
T Abc(T&a,T&b,T&c){
return a+b+b*c+(a+b-c)/(a+b)+4;
}
int main(int argc, char** argv) {
int a=2,b=3,c=4;
cout<<Abc(a,b,c)<<endl;
return 0;
}
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;
template<class T>
T Abc(T&a,T&b,T&c){
return a+b+b*c+(a+b-c)/(a+b)+4;
}
int main(int argc, char** argv) {
int a=2,b=3,c=4;
cout<<Abc(a,b,c)<<endl;
return 0;
}
program 1.3. fungsi template parameter
#include <iostream>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;
template<class T>
T Abc(T a,T b,T c){
return a+b+b*c+(a+b-c)/(a+b)+4;
}
int main(int argc, char** argv) {
cout<<Abc(2,3,4)<<endl;
return 0;
}
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;
template<class T>
T Abc(T a,T b,T c){
return a+b+b*c+(a+b-c)/(a+b)+4;
}
int main(int argc, char** argv) {
cout<<Abc(2,3,4)<<endl;
return 0;
}
program 1.2.
#include <iostream>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;
float Abc(float a,float b,float c){
return a+b+b*c+(a+b-c)/(a+b)+4;
}
int main(int argc, char** argv) {
cout<<Abc(2,3,4)<<endl;
return 0;
}
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;
float Abc(float a,float b,float c){
return a+b+b*c+(a+b-c)/(a+b)+4;
}
int main(int argc, char** argv) {
cout<<Abc(2,3,4)<<endl;
return 0;
}
Langganan:
Postingan (Atom)