New course! Every coder should learn Generative AI!
Try a free lesson0
C++
#include <iostream> using namespace std ; int main() { int x=12; int y=7; ----x; cout<<--x<<endl; ++++++y; cout<<++++y<<endl; cout<<----x<<endl; y++; cout<<y<<endl; ----x; cout<<x<<endl; cout<<------y; } Is there any one has another way to solution it
3 Answers
+ 2
What are you trying to solve anyway 🤣
+ 1
How to make the variable is growing step or more or decrease without ---- double or ++++
+ 1
See, You can use the increment (++) or decrement (--) only once at a time.
you can use
++a;
++a;
two times but you can't use ++++a; for the same result.
If you want to increment a variable many times you can use loops like
for(int i=0;i<10;i++)
{ ++a;}
But adding the +/- sign many times won't work. Keep it clear.