Zadania z dziś
This commit is contained in:
13
Laboratorium/20221109155432/euklides.cpp
Normal file
13
Laboratorium/20221109155432/euklides.cpp
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
#include <iostream>
|
||||||
|
#include <cmath>
|
||||||
|
|
||||||
|
double odleglosc(double xa, double ya, double xb, double yb)
|
||||||
|
{
|
||||||
|
return std::sqrt(std::pow(xa-xb, 2)+std::pow(ya-yb, 2));
|
||||||
|
}
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
std::cout << odleglosc(1,1,2,1) << std::endl;
|
||||||
|
std::cout << odleglosc(1,1,2,2) << std::endl;
|
||||||
|
std::cout << odleglosc(1,1,-2,21) << std::endl;
|
||||||
|
}
|
||||||
14
Laboratorium/20221109155432/gnirts.cpp
Normal file
14
Laboratorium/20221109155432/gnirts.cpp
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
#include <iostream>
|
||||||
|
#include <string>
|
||||||
|
std::string gnirts(std::string &wejscie){
|
||||||
|
int dlugosc = sizeof(&wejscie)/sizeof(int);
|
||||||
|
for (int i : dlugosc){
|
||||||
|
aaa
|
||||||
|
}
|
||||||
|
return gnirts;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
std::cout << gnirts("Hello, world!")<< std::endl;
|
||||||
|
}
|
||||||
16
Laboratorium/20221109155432/miernikkrzyku.cpp
Normal file
16
Laboratorium/20221109155432/miernikkrzyku.cpp
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
#include <iostream>
|
||||||
|
#include <string>
|
||||||
|
int miernikkrzyku(std::string wejscie){
|
||||||
|
int counter = 0;
|
||||||
|
for (char znak : wejscie){
|
||||||
|
if (znak == 'a'){
|
||||||
|
counter++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return counter;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
std::cout << miernikkrzyku("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") << std::endl;
|
||||||
|
}
|
||||||
14
Laboratorium/20221109155432/ntapotega.cpp
Normal file
14
Laboratorium/20221109155432/ntapotega.cpp
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
double potega(int wykladnik, double podstawa){
|
||||||
|
double podstawa_old = 1;
|
||||||
|
for (int i = 0; i < wykladnik; i++) {
|
||||||
|
podstawa_old *= podstawa;
|
||||||
|
}
|
||||||
|
return podstawa_old;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
std::cout << potega(3, 21.5) << std::endl;
|
||||||
|
}
|
||||||
11
Laboratorium/20221109155432/szescian.cpp
Normal file
11
Laboratorium/20221109155432/szescian.cpp
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
long long szescian(int podstawa)
|
||||||
|
{
|
||||||
|
return podstawa*podstawa*podstawa;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
std::cout << szescian(2) << "\n" << szescian(3) << "\n" << szescian(42) << std::endl;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user