Commit 557fe5c7 by Patryk Czarnik

Zajęcia nr 2

parent 0f14a65d
#include <iostream>
int main()
{
std::cout << "Hello world";
return 0;
}
#include <iostream>
int main()
{
// Dwa sposoby przchodzenia do następnej linii:
// 1) symbol \n
std::cout << "Pierwszy tekst\nDrugi tekst\n";
std::cout << "Trzeci tekst";
// 2) std::endl
// To wymaga więcej pisania, ale jest uważane za "porządniejsze"
std::cout << " dalszy ciag trzeciego" << std::endl;
std::cout << "Czwarty tekst" << std::endl;
return 0;
}
#include <iostream>
// Jeśli nie chcecie pisać za każdym razem std::
// to można raz na początku napisać:
using namespace std;
int main()
{
// Dwa sposoby przchodzenia do następnej linii:
// 1) symbol \n
cout << "Pierwszy tekst\nDrugi tekst\n";
cout << "Trzeci tekst";
// 2) std::endl
// To wymaga więcej pisania, ale jest uważane za "porządniejsze"
cout << " dalszy ciag trzeciego" << endl;
cout << "Czwarty tekst" << endl;
return 0;
}
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
cout << 2+2 << endl;
cout << "Wynik dzialania: " << 2*3+4*5 << endl;
cout << 10 / 3 << endl;
cout << 10 % 3 << endl; // reszta z dzielenia
cout << 10.0 / 3 << endl;
cout << "Pierwiastek: " << sqrt(2) << endl;
cout << "5 ^ 3 = " << pow(5, 3) << endl;
return 0;
}
#include <iostream>
using namespace std;
int main()
{
cout << "Jak masz na imie?" << endl;
string imie;
cin >> imie;
cout << "Witaj " << imie << endl;
return 0;
}
#include <iostream>
using namespace std;
int main()
{
double a, b;
cout << "Podaj pierwszy bok: ";
cin >> a;
cout << "Podaj drugi bok: ";
cin >> b;
cout << "Pole prostokata: " << a*b << endl;
cout << "Obwod prostokata: " << 2*a + 2*b << endl;
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment