Programwanie 28.II, Laborki, PP

[ Pobierz całość w formacie PDF ]
Rozmiar#include <iostream>#include <cstdio>using namespace std;int main(){cout <<"char " <<sizeof(char)<<endl;cout <<"short " <<sizeof(short)<<endl;cout <<"int " <<sizeof(int)<<endl;cout <<"long " <<sizeof(long)<<endl;cout <<"float " <<sizeof(float)<<endl;cout <<"double " <<sizeof(double)<<endl;cout <<"long double " <<sizeof(long double)<<endl;cout <<"7 " <<sizeof(7)<<endl;cout <<"5/3 " <<sizeof(5/3)<<endl;cout <<"5==3.14 " <<sizeof(5==3.14)<<endl;cout <<"5/3+1.0 " <<sizeof(5/3+1.0)<<endl;cout <<"'A' " <<sizeof('A')<<endl;cout <<"Informatyka " <<sizeof"Informatyka"<<endl;cin.get(),cin.get();return 0;}Fibonaciego rekurencyjnie i leteracyjnie#include <iostream>#include <cstdio>#include <cmath>using namespace std;long long Fib (int n){long double p5=sqrt(5);return(1/p5*(pow((1+p5)/2,n)-(pow((1-p5)/2,n))));}int main(){int n;long long F;cout <<"N= ";cin >>n;F=Fib(n);cout <<"F ("<<n<<")= "<<F;cin.get(),cin.get();return 0;} [ Pobierz całość w formacie PDF ]