Podstawy Programowania, Studia, Semestr 3, Podstawy programowania, Labolatoria

[ Pobierz całość w formacie PDF ]
15 SYMBOLI '-'#include <cstdlib>#include <iostream>#include <math.h>using namespace std;int main(){int i=0,t;cout<<"petla while\n";while(i<=14){cout<<"-";i++;}cout<<"\npetla for\n";for(t=0;t<=14;t++){cout<<"-";}system("PAUSE");return EXIT_SUCCESS;}LICZBY PARZYSTE#include <cstdlib>#include <iostream>#include <math.h>using namespace std;int main(){int o=101,u;cout<<"petla while\n";while(o<=101 && o>=0 && o--){cout<<o<<", ";o--;}cout<<"\npetla for\n";for(u=100;u>=0;u--){cout<<u<<", ";u--;}system("PAUSE");return EXIT_SUCCESS;}LICZBY PODZIELNE PRZEZ 7#include <cstdlib>#include <iostream>#include <math.h>using namespace std;int main(){int i=70,w=0,t=70,a;cout<<"petla while"<<endl;while(w<10){cout<<i<<", ";i=i+7;w++;}cout<<"\npetla for"<<endl;for(a=0;a<10;a++){cout<<t<<", ";t=t+7;}system("PAUSE");return EXIT_SUCCESS;}LICZBY MALEJ?CE#include <cstdlib>#include <iostream>#include <math.h>using namespace std;int main(){int a;cout<<"Podaj liczbe"<<endl;cin>>a;int b=a;cout<<"petla for"<<endl;for( ;a>=0;a--){cout<<a<<", ";}cout<<"\npetla while"<<endl;while(b>=0){cout<<b<<", ";b--;}system("PAUSE");return EXIT_SUCCESS;}SUMA#include <cstdlib>#include <iostream>#include <math.h>using namespace std;int main(){int b,s=0,k,j;cout<<"petla while"<<endl;while (b!=2){cout<<"podaj liczbe"<<endl;cin>>b;s=s+b;}cout<<"wynik="<<s<<endl;cout<<"petla for"<<endl;for(k=0;j!=2; ){cout<<"podaj liczbe"<<endl;cin>>j;k=k+j;}cout<<"wynik="<<k<<endl;system("PAUSE");return EXIT_SUCCESS;} [ Pobierz całość w formacie PDF ]

  • zanotowane.pl
  • doc.pisz.pl
  • pdf.pisz.pl
  • tlumiki.pev.pl