online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
/****************************************************************************** Online C++ Compiler. Code, Compile, Run and Debug C++ program online. Write your code in this editor and press "Run" button to compile and execute it. *******************************************************************************/ #include <iostream> //#include <windows.h> // main.cpp:10:10: fatal error: Windows.h: No such file or directory // 10 | #include <Windows.h> // | ^~~~~~~~~~~ // compilation terminated. #include <stdlib.h> bool red(int x, int y, int m =10, int k =0){ return x==k; } bool blue(int x, int y, int m =10, int k =0){ bool dziedzina = x>k and x < (m+k)/2 +1; return y==-(x-k)+m and dziedzina; } bool green(int x, int y, int m =10, int k =0){ bool dziedzina = x>(m+k)/2 and x < (m+k); return y==(x) and dziedzina; } bool purple(int x, int y, int m =10, int k =0){ return x==m; } class shapeW { int n=4; int k=7,v =3, count=n+k,m=count-1; char ch='W', bg='.'; public: void print(); void clear(); //extend shrink shapeW & operator++()//https://en.cppreference.com/w/cpp/language/operators { system("clear");//https://stackoverflow.com/questions/17271576/clear-screen-in-c-and-c-on-unix-based-system if(n<100) n++; print(); return *this; // return new value by reference } shapeW & operator--()//https://en.cppreference.com/w/cpp/language/operators { system("clear");//https://stackoverflow.com/questions/17271576/clear-screen-in-c-and-c-on-unix-based-system if(n>0) n--; print(); return *this; // return new value by reference } //https://learn.microsoft.com/pl-pl/cpp/cpp/increment-and-decrement-operator-overloading-cpp?view=msvc-170 }; int main(){ shapeW leter; leter.print(); std::cout<<"\n [k] zakoncz, \n [+] powieksz, [-] pomiejsz,\n [l] presun lewo, [p] presun prawo : "; while (1){ switch (std::cin.get()){ case '+': ++leter;break; case '-': --leter;break; case 'l': system("clear"); std::cout<<"\npotrzebna metoda klasy shapeW zwiekszająca k\n"<<std::endl; break; case 'p': system("clear"); std::cout<<"\npotrzebna metoda klasy shapeW zmniejszająca k\n"<<std::endl; break; case 'u': system("clear"); std::cout<<"\npotrzebna metoda klasy shapeW zwiekszająca v\n"<<std::endl; break; case 'd': system("clear"); std::cout<<"\npotrzebna metoda klasy shapeW zmniejszająca v\n"<<std::endl; break; case '\n': std::cout<<"\n [k] zakoncz, \n [+] powieksz, [-] pomiejsz,\n [l] presun lewo, [p] presun prawo : "; break; case 'k': return 0; break; default : break; } } return 0; } void shapeW::print(){ int count=n+k,m=count-1; for (size_t y = 0; y < v; y++) std::cout<<std::string(k+n,bg)<<'\n'; for (size_t y = k; y < count; y++) { for (size_t x = 0; x < count; x++) { if (red(x,y,m,k)||blue(x,y,m,k)||green(x,y,m,k)||purple(x,y,m,k)) { std::cout<<ch; } else std::cout<<bg; } std::cout<<std::endl; } }

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text
×

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue