Posts

Showing posts from May, 2021

Friend function example with surce code in c++,

 Simple Friend function  #include<iostream> using namespace std; class myclass{ int a, b; public: friend int add(void); friend int sub(void); void setval(){ cout<<" value of a: "; cin>>a; cout<<"value of b: "; cin>>b; } }; int add(void){ myclass obj; obj.setval(); int tenp; //cout<<"A + B = "<<obj. a + obj.b; tenp =  obj.a + obj. b; return tenp; } int sub(void){ myclass obj ; obj. setval(); int temp; temp = obj. a - obj.b; return temp; } int main(){ int result,result2; result = add(); cout<<result<<endl; result2 = sub(); cout<<result2; return 0; }

Source code is here

                          #Code is here  #include <iostream> using namespace std; int main() {     for ( int i = 0; i<5; i++){           // cout<<""     cout<< "      oo     " <<endl;     cout<< "     oooo    " <<endl;     cout<< "    oooooo   " <<endl;     cout<< "   oooooooo  " <<endl;     cout<< "  oooooooooo " <<endl;     cout<< " oooooooooooo " <<endl;     cout<< "oooooooooooooo " <<endl;     cout<< "oooooooooooooo " <<endl;     cout<< " oooooooooooo " <<endl;  ...

#code C++ 2021

 Welcome to my blog.you can  SUBSCRIBE   my YouTube channel.               Code is here #include <iostream> #include <string> using namespace std; int main() {     const   int a= 2021;     int b;     const int c= 365;     const int d = 80;     cout << "Enter your date of birth: " ;     cin>>b;     cout<< "your Age is now: " <<((a-b))<<endl;     cout<< "your Available Age is: " <<((a - b)-d);     cout<< "\n your Age in Days: " <<((a-b)*c);     cout<< "\nyour Available Age in days:\n " <<(((a-b)-d)*c);     cout<< "\nYour Age in weeks: " <<(((a - b)*c)/7)<< " weeks" ;     return 0; }

A Birthday wish program source code in c++ simple

    Birthday Wish This is a program. Who wish you birthday at 300 times. and you coustmize. You are new so please SUBSCRIBE my YouTube channel. Much more source code.       Source Code is here  copy here to πŸ‘‡πŸ‘‡πŸ‘‡πŸ‘‡ //[This is a simple Birthday wish program] #include <iostream> #include <string> using namespace std; int main(){ string user_input; //Take user input (string) cout<< "What is your name " <<endl; cin>>user_input; // here is user_input string wish = "HAPPY BIRTHDAY TO YOUπŸ‘‰" ; // you can customize your Type for ( int i = 1; i < 300; /* you can change the number of print*/ i++){ cout<<wish<<user_input<<endl; } // Making by Techrozo YouTube channel //Making Date:- 05/05/2021(Wednesday) } hereπŸ‘†πŸ‘†πŸ‘†πŸ‘†πŸ‘†πŸ‘†

Making a simple game using c++ if/else and finctions

Image
   Simple Game C++   this is a simple game making c++ use functions and if/else statement and simple cout and cin. the game make is veary easy anyone can make the game. this is my blpg and my youtube channel you can subscribe the channel and help me to faster grow my channel. i hope you all help me                   code  #include <iostream> using namespace std; void start_game(){ char answer; int score = 1; cout<< "What is 1+1" <<endl; cout<< "(a)= 5" <<endl; cout<< "(b)= 6" <<endl; cout<< "(c)= 9" <<endl; cout<< "(d)= 2" <<endl; cout<< "choes a option " <<endl; cin>>answer; if (answer == 'd' ){ cout<< "you choes right answer" <<endl; cout<< "score::" <<score++<<endl; } else { cout<< "You choes wrong Answer" <<endl; } cout<< "Wha...