Search
 
SCRIPT & CODE EXAMPLE
 

CPP

how to use decrement operator in c++

#include <iostream>
using namespace std;

int main()
{
  int x = 5, y = 5;
  
  cout << x-- << " " << --y ;
  // Outputs 5 4
  
  return 0;
}
Comment

increment c++

int main(){
  int i = 0;
  cout << i << endl; //Outputs 0
  i++; //Now i is 0 + 1
  cout << i << endl; // Outputs 1
  return 0;
}
Comment

C++ Increment and Decrement

	int b, a, e, d, c, f;
    int num = 57;
    cout << "The number is " << num << endl;

    b = ++num;
    a = ++num;
    e = a + 1;
    cout << "After post increment by 1, the number is " << b << endl;
    cout << "After pre increment by 1, the number is " << a << endl;
    cout << "After increasing by 1, the number is " << e << endl;

    d = --e;
    c = --e;
    f = c - 1;
    cout << "After post decrement by 1, the number is " << d << endl;
    cout << "After pre decrement by 1, the number is " << c << endl;
    cout << "After decreasing by 1, the number is " << f << endl;
Comment

decrement c++

int x = 5;
x--;
cout << x << endl;
//outputs 4
Comment

PREVIOUS NEXT
Code Example
Cpp :: c++ loop array 
Cpp :: frequency of characters in a string in c++ 
Cpp :: c++ handling 
Cpp :: print all even number using for loop c++ 
Cpp :: c++ delete int 
Cpp :: #include using namespace std; int main() { double leashamt,collaramt,foodamt,totamt; cout<<"Enter the amount spent for a leash : "; 
Cpp :: do while loop c++ 
C :: boilerplate c 
C :: how to slow voice speed in pyttsx3 
C :: Write a C program to print all unique elements in the array. 
C :: arduino wifi ip address to string 
C :: write in file in c 
C :: Invalid public key for CUDA apt repository 
C :: printf with bool 
C :: octave sum all elements in matrix 
C :: random number c 
C :: arduino client disconnect 
C :: determination of armstrong number in c 
C :: hashmap c 
C :: how to sleep in c 
C :: differnce between spooling and buffering 
C :: c print multiple variables 
C :: Syntax To Take Input In C 
C :: .sh template 
C :: stack push code 
C :: search in gz file 
C :: how to add 1 to 10 in c 
C :: pointers to a function in c 
C :: rust cross compile 
C :: How to copy one string into another in C 
ADD CONTENT
Topic
Content
Source link
Name
9+8 =