OOP Assignments , Linux commands , C++ Algorithms , Programming concepts , Best Algorithms , C++ Projects , Latest Computer Tools , Ethical Hacking , Hacking , Computer secrets , search for any thing you need related to computer.
Windows activation key finder
Get link
Facebook
X
Pinterest
Email
Other Apps
This file can find activation key of windows for you just run it and it will show you the activation key for your PC.activation key finder
Following is the code that will help you in the assignment for the addition of the arrays using operator overloading and returning an object. #include<iostream> using namespace std; int num; struct add { int ar[20]; }; add operator+(add &a1,add &a2) { add a3; for(int i=0;i<num;i++) a3.ar[i]=a2.ar[i]+a1.ar[i]; return a3; } int main() { add a1,a2,a3; cout<<"How many elements to be stored (max 20) : "; cin>>num; cout<<"Enter elements of array a1 : "; for(int i=0;i<num;i++) cin>>a1.ar[i]; cout<<"Enter elements of array a2 : "; for(int i=0;i<num;i++) cin>>a2.ar[i]; a3=a1+a2; cout<<"Addition of two arrays : "; for(int i=0;i<num;i++) ...
Here is the way you can find the square root of any number by writing your own code in c++. #include<iostream> using namespace std; double sqrt(double num){ double stop_condition = 0.00000001; double guess = num/2; while((guess-num/guess) > stop_condition){ guess = (guess+num/2)/2; } return guess; } int main(){ double num = 4; cout<<"The result is: "<<sqrt(num)<<endl; return 0; }
#include <iostream> using namespace std ; class position { public: int x ; int y ; position (){ x = 0 ; y = 0 ; } position operator + ( position & p_any ){ position p1 ; p1 . x = this -> x + p_any . x ; p1 . y = this -> y + p_any . y ; return p1 ; } }; int main (){ position p1 ; cout<< "Enter the intial values of x and y cordinates: " ; cin>> p1 . x >> p1 . y ; position p2 ; cout<< "Enter the new values for x and y to be shifted: " ; cin>> p2 . x >> p2 . y ; position p3 ; p3 = p1 + p2 ; cout<< "The initial values were: " << p1 . x << " " << p1 . y <<endl; cout<< "The new values are: " << p3 . x << " " << p3 . y <<endl; } // from now onward this is the second task #in...
Comments
Post a Comment