#C++ Day5 October 11 2025


//5-1-1 math symbols


#include <iostream>


using namespace std;



int main() {


int a = 1;


int b = 3;


cout << a+b << endl;


cout << a – b << endl;


cout << a * b << endl;


cout << a / b << endl; //if int divide int, there will be int too


cout << a*1.0 / b << endl;//if int multiple float before divide, there will be float



a = 10000000;


b = 100000;


cout << a * b << endl; //output will out the range of int


cout << (long long)a * b << endl; //we can translate it forcely



a = -1;


b = 2;


cout << a / b << endl;//just cut of the dot number



a = +1;


b = -a;


int c = -(-a);


cout << a <<‘ ‘ << b <<‘ ‘ << c << endl;//postive & negative



char A = ‘A’;


A = A + 1;


A = A + 24;



cout << A << endl;



return 0;


}




//5-1-2 mod % symbol


#include <iostream>


using namespace std;



int main(){


int a = 100;


int b = 9;


cout << a % b << endl; //1



a = 100;


b = -9;


cout << a % b << endl; //1



a = -100;


b = 9;


cout << a % b << endl;//the mod symbol %;-100 % 9 is  9*-11 (near 0 direction) not -12 in C/C++ launguage


//-1





a = -100;


b = -9;


cout << a % b << endl; //-100 -(-9)*11=-1


//-1



//1、the symbol of mod is the same as the be devided number


//first we should take the negative symbol from the  be devided number 


//second we use it as 100 = -9 * (-11) + 1 


//third the left +1 is the lease number and add the negative symbol – to the 1


//fourth the final answer is  -1


return 0;


}




//5 – 1-3 ++ & –symbol


#include <iostream>


using namespace std;



int main() {


int a = 6; 


a++; //a=a+1


cout << a << endl;


++a; //a=a+1


cout << a << endl;


//the same in the two ways



int j = 8;


int x = a++; //first give the value to x, then add 1 to a


int y = ++j; //first add 1 to the value , then give the value to y (this type is more effective)


cout << x << endl; 


cout << y << endl;



int z = (a++) + (++a);//9+11=20 we must not to write this type code ,because it will make a big problem


cout << z << endl;



a–; //a=a-1


cout << a << endl;


–a;//a=a-1


cout << a << endl; 


}



//5 – 2 valued symbols


#include <iostream>


using namespace std;



int main() {


int x = 9;


int y = 6;


x = y; // let y to x


cout << x << endl;



x += y; //x=x+y   the length is 10 bytes to 7 bytes


cout << x << endl;



x -= y; //x=x-y


cout << x << endl;



x *= y; //x=x*y


cout << x << endl;



x /= y; //x=x/y


cout << x << endl;



x %= y; //x=x%y


cout << x << endl;


return 0;


}