Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gruz linux #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.o
.idea/
76 changes: 76 additions & 0 deletions Lab3/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
// Aleksander Chohura Grupa: 3

#include <iostream>

#pragma clang diagnostic push
#pragma ide diagnostic ignored "UnreachableCode"
#pragma ide diagnostic ignored "ConstantConditionsOC"
using namespace std;

int main() {
cout << "##### Zad 1 #####" << endl;
int minusOne = -1;
int zero = 0;
int one = 1;

if (minusOne) {
cout << "minusOne == true" << endl;
}

if (zero) {
cout << "zero == true" << endl;
}

if (one) {
cout << "one == true" << endl;
}

cout << "##### Zad 2 #####" << endl;
cout << "pętla while" << endl;

int i = 0;
while (i <= 20) {
if ((i + 1) % 2) {
cout << i << endl;
}
i++;
}

cout << "pętla do...while" << endl;
i = 0;
do {
if ((i + 1) % 2) {
cout << i << endl;
}
i++;
} while (i <= 20);

cout << "pętla for" << endl;

for (int i = 0; i <= 20; i++) {
if ((i + 1) % 2) {
cout << i << endl;
}
}

cout << "##### Zad 3 #####" << endl;

for (int i = 30; i >= 20; i--) {

cout << i << endl;
}

cout << "##### Zad 4 #####" << endl;
int counter = 0;
float bigNumber = 100;
while (bigNumber >= 0.00004) {
counter++;
bigNumber = bigNumber / 2;
}
cout << "liczba podzieleń:" << endl;
cout << counter << endl;
cout << "liczba bigNumber po podzieleniu" << endl;
cout << bigNumber << endl;
}


60 changes: 60 additions & 0 deletions Lab4/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#include "iostream"

using namespace std;

int main() {

cout << "#####Zad1#####" << endl;

cout << "Podaj Liczbę" << endl;
double liczba;
cin >> liczba;
cout << "oto twoja liczba" << endl;
cout << liczba << endl;

cout << "#####Zad2#####" << endl;

double calkowite[10] = {};

for (int i = 0; i < 10; ++i) {
calkowite[i] = i + 1;
}
for (int i = 0; i < 10; ++i) {
cout << calkowite[i] << endl;
}
cout << "#####Zad3#####" << endl;
double tab[10] = {};
cout << "podaj 10 liczb" << endl;
for (int i = 0; i < 10; ++i) {
cin >> tab[i];
}
cout << "oto podane liczby" << endl;
for (int i = 0; i < 10; ++i) {
cout << tab[i] << endl;
}
cout << "#####Zad4#####" << endl;
double suma;
double srednia;
for (int i = 0; i < 10; ++i) {
suma = suma + tab[i];
}
srednia = suma / 10;
double najwieksza = tab[1];
for (int i = 0; i < 10; ++i) {
if (najwieksza < tab[i]) {
najwieksza = tab[i];
}
}
double najmniejsza = tab[1];
for (int i = 0; i < 10; ++i) {
if (najmniejsza > tab[i]) {
najmniejsza = tab[i];
}
}
cout << "najwieksza liczba" << endl;
cout << najwieksza << endl;
cout << "najmniejsza liczba" << endl;
cout << najmniejsza << endl;
cout << "srednia liczb" << endl;
cout << srednia << endl;
}