diff --git a/iostream.cpp b/iostream.cpp new file mode 100644 index 0000000000000000000000000000000000000000..f73d36c4dde48b5f58f897dc8524506cef661296 --- /dev/null +++ b/iostream.cpp @@ -0,0 +1,58 @@ +#include <iostream> //+stdio.h v c++ +#include <iomanip> + +namespace A{ + void foo(void){ + std::cout << "Bar" << std::endl; + } +} + +namespace B{ + void foo(void){ + std::cout << "Bar ale v B" << std::endl; + } +} + +using namespace std; + +namespace mujstd=std; + +//+main stejne jako v c +int main(int argc, char *argv){ + //+operator proudoveho zapisu << + //+ cout vypis do terminalu + std::cout << "Hollo PPC" << std::endl; + A::foo(); + B::foo(); + cout << "Vypis bez std" << endl; + + //+ cin nacteni z terminalu + int a,b; + cout << "Zadej dve cisla" << endl; + cin >> a >>b; + + if(std::cin.good()){ + cout << "Zadal jsi " << a << "a" << b << mujstd::endl; + } + else{ + std::cout << "Zopakuj si datove typy" << std::endl; + cout << ((cin.rdstate() & ios_base::badbit) ? "B":"b"); + cout << ((cin.rdstate() & ios_base::eofbit) ? "E":"e"); + cout << ((cin.rdstate() & ios_base::failbit) ? "F":"f"); + cout << endl; + } + + double pi=3.14159; + + std::cout<<pi<<std::endl; + std::cout<<std::setprecision(3)<<pi<<std::endl; + std::cout<<setw(10)<<pi<<std::endl; + std::cout<< std::fixed<<pi<<std::endl; + std::cout<<std::scientific<<pi<<std::endl; + + + std::string name; + std::cout<< + + return 0; +} \ No newline at end of file