Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <ctype.h>
- #include <string>
- using namespace std;
- //----------------------------------------------------------------------------
- void zadanie1()
- {
- int liczba;
- int dzielnik;
- cout<<"Podaj liczbe";
- cin>>liczba;
- cout<<"Podaj dzielnik";
- cin>>dzielnik;
- if (liczba%dzielnik==0)
- cout<<"1";
- else
- cout<<"0";
- }
- //----------------------------------------------------------------------------
- void zadanie2(int tab[100], int wartosc)
- {
- int test=0;
- for (int i=0; i<=99; i++)
- {
- if (tab[i]==wartosc)
- test++;
- }
- if (test>0)
- cout<<"1";
- else
- cout<<"0";
- }
- //----------------------------------------------------------------------------
- void zadanie3()
- {
- char tekst[] = "Ala ma kota, a kot ma Ale";
- int dlugosc=sizeof(tekst)/sizeof(char);
- for(int i=0; i<=dlugosc-1; i++)
- {
- tekst[i]=toupper(tekst[i]);
- }
- cout<<tekst;
- }
- //----------------------------------------------------------------------------
- int main() {
- while(true)
- {
- cout<<"Wybierz zadanie:"<<endl;
- cout<<"1. Zadanie 1"<<endl;
- cout<<"2. Zadanie 2"<<endl;
- cout<<"3. Zadanie 3"<<endl;
- char wybor;
- cin>>wybor;
- int tab[100]={1,2,3,4,5,6};
- if (wybor=='q' || wybor=='Q')
- exit(0);
- else
- {
- switch(wybor)
- {
- case '1': zadanie1(); break;
- case '2': zadanie2(tab, 7); break;
- case '3': zadanie3(); break;
- }
- }
- cout<<endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement