Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 11.)
- #include <iostream>
- #include <string>
- using namespace std;
- int main()
- {
- int x;
- cout<<"Podaj liczbe z przedzialu od 1 do 7"<<endl;
- cin>>x;
- string dni[7] = {"poniedzialek","wtorek","sroda","czwartek","piatek","sobota","niedziela"};
- if (x>7) {
- cout<<"Niepoprawna liczba";
- } else {
- if (x<1) {
- cout<<"Niepoprawna liczba";
- } else {
- cout<<dni[x-1];}
- }
- return 0;
- }
- 12.)
- #include <iostream>
- using namespace std;
- int main()
- {
- int x,y,z;
- cout<<"Podaj trzy liczby"<<endl;
- cin>>x>>y>>z;
- if (x+y>z && x+z>y && z+y>x) {
- cout<<"Obwod trojkata wynosi "<<x+y+z;
- } else {
- cout<<"Nie mozna zbudowac trojkata";}
- return 0;
- }
- 13.)
- #include <iostream>
- using namespace std;
- int main()
- {
- int x,y;
- char z;
- cout<<"Podaj dwie liczby"<<endl;
- cin>>x>>y;
- cout<<"Podaj znak + - * lub /"<<endl;
- cin>>z;
- if (z == '+') {
- cout<<x+y;
- } else {
- if (z == '-') {
- cout<<x-y;
- } else {
- if (z == '*') {
- cout<<x*y;
- } else {
- if (z == '/') {
- cout<<x/y;
- } else {
- cout<<"Znak niepoprawny";
- }
- }
- }
- }
- return 0;
- }
- 16.)
- #include <iostream>
- using namespace std;
- int main()
- {
- int r;
- cout<<"Podaj rok"<<endl;
- cin>>r;
- if (r%4 == 0 && r%100 != 0) {
- cout<<"Rok przestepny";
- } else {
- if (r%400 == 0) {
- cout<<"Rok przestepny";
- } else {
- cout<<"Rok nie przestepny";
- }
- }
- return 0;
- }
- 17.)
- #include <iostream>
- using namespace std;
- int main()
- {
- int z;
- cout<<"Podaj liczbe"<<endl;
- cin>>z;
- if (z<0) {
- z = -z;
- }
- cout<<"Wartosc bezwzgledna wynosi: "<<z;
- return 0;
- }
- 18.)
- #include <iostream>
- #include <string>
- using namespace std;
- int main()
- {
- int x;
- cout<<"Podaj liczbe"<<endl;
- cin>>x;
- string miesiac[12] = {"styczen","luty","marzec","kwiecien","maj","czerwiec","lipiec","sierpien","wrzesien","pazdziernik","listopad","grudzien"};
- if (x>12) {
- cout<<" Podano nieprawidlowa liczbe";
- } else {if (x<1) {
- cout<<"Podano nieprawidlowa liczbe";
- } else {
- cout<<"Podano prawidlowa wartosc, ktorej odpowiada miesiac: "<<miesiac[x-1];
- }}
- return 0;
- }
- 19.)
- #include <iostream>
- #include <string>
- using namespace std;
- int main()
- {
- int x,y,z;
- cout<<"Podaj poczatkowa wartosc przedzialu"<<endl;
- cin>>x;
- cout<<"Podaj koncowa wartosc przedzialu"<<endl;
- cin>>y;
- cout<<"Podaj liczbe do sprawdzenia"<<endl;
- cin>>z;
- if (z>x && z<y) {
- cout<<z<<" znajduje sie w podanym przedziale";
- } else {
- cout<<z<<" nie znajduje sie w podanym przedziale";
- }
- return 0;
- }
- 20.)
- #include <iostream>
- using namespace std;
- int main()
- {
- int x,y;
- cout<<"Wpisz jaki naklad chcesz wydrukowac"<<endl;
- cin>>y;
- if (y<500) {
- x = 15;
- } else {
- if (y>500 && y<1000) {
- x = 12;
- } else {
- x = 10;
- }
- }
- cout<<"Naklad wynosi: "<<y<<"koszt wydruku to: "<<x*y<<" przy mnozniku: "<<x;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment