https://docs.google.com/document/d/16CnfKOQI8-2_831HP18KG52ETqqdPmhy3sIzq2vNZXE/edit
Hanoi torony:
#include <iostream>using namespace std;double hatvany(const double a, const int n){
if(n==0){
return 1;
} else {
return a*hatvany(a,n-1);
}}//int i=0;int fib(const int n){
// i++;if(n==0){
return 0;
} else if(n==1){
return 1;
} else {
return fib(n-1)+fib(n-2);
}}void hanoi(const int h, char honnan, char hova, char mivel){
if(n>0){
hanoi(n-1, )
}}int main(){
// cout << hatvany(2,3) << endl;// cout << fib(10) << endl;// cout << "lepesek: " << i << endl;hanoi(3,'A','C','B'); // A-ról C-re rakjuk B segítségével
return 0;
}
Stuct:
#include <iostream>#include <vector>using namespace std;struct Eredmeny{
bool van;int hol;
}Eredmeny fel11(const vector<double> hom, const int n){
Eredmeny sv;if(n==-1){
// fel11:=(hamis,?) a feladatbansv.van = false;
return sv;
} else if(hom[n]<-10){
// fel11:=(igaz,n)sv.van = true;
sv.hol = n;
return sv;
} else {
return fel11(hom, n-1);
}}int main()
{vector<double> hom;
Eredmeny er;// beolvasas(hom); // othonrahom.push_back(1);
hom.push_back(-11);
hom.push_back(5);
er = fel11(hom, hom.size()-1);
cout << er.van << er.hol << endl;
return 0;
}