Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- pierwsze:
- #include <iostream>
- #include <cmath>
- #include <iomanip>
- using namespace std;
- int main() {
- int r;
- cout << "Wprowadz wartosc promienia: ";
- cin >> r;
- long double pole = 4*M_PI*r*r;
- long double objetosc = 4/3*M_PI*r*r*r;
- cout << "Pole powierzchni kuli: " << "********" << pole << endl;
- cout << "Objetosc kuli: " << setprecision(7) << objetosc << endl;
- return 0;
- }
- ===========================================================
- trzecie:
- #include <iostream>
- #include <cstdlib>
- #include <ctime>
- using namespace std;
- int main() {
- srand(time(NULL));
- int liczba = -32+rand()%(61);
- cout << "Wygenerowana liczba to: " << liczba << endl;
- return 0;
- }
- ==========================================================
- czwarte:
- #include <iostream>
- #include <ctime>
- using namespace std;
- int main() {
- int wybor;
- while (wybor!=4) {
- cout << "-=-PROGRAM-=-" << endl;
- cout << "1. Dane ucznia" << endl;
- cout << "2. Aktualna data" << endl;
- cout << "3. Oblicz pole kwadratu!" << endl;
- cout << "4. Zakonczenie programu" << endl;
- cout << endl;
- cout << "Wybierz opcje: ";
- cin >> wybor;
- switch(wybor){
- case 1:
- cout << "Kamila Butrym" << endl;
- cout << endl;
- break;
- case 2:
- cout << __DATE__ << endl;
- cout << endl;
- break;
- case 3:
- int a;
- cout << "Podaj dlugosc boku: ";
- cin >> a;
- cout << "Pole kwadratu to: " << a*a << endl;
- cout << endl;
- break;
- case 4:
- exit(1);
- default:
- cout << "Bledne dane!" << endl;
- cout << endl;
- }
- }
- return 0;
- }
- ====================================================================
- piate (robisz to na kartce, ale kod mi pomogl to rozwiazac):
- #include <iostream>
- using namespace std;
- int main(){
- int a=6; int b=4; int c=15;
- b*=2;
- c/=4;
- cout << "wartosc b: " << b << endl;
- cout << "wartosc c: " << c << endl;
- cout << "8-3 = " << b-c << endl;
- cout << "++b = " << ++b << endl;
- cout << "c-- = " << c-- << endl;
- cout << "wartosc c: " << c << endl;
- a/=11;
- cout << "a/= " << a << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement