Q. If sum of two integer is 14 and if one of them is 8 then find other integer. Ans: Well, this is very simple. Simply, one integer is 8 and sum of two integers is 14. So, we need to subtract the number 8 from their sum of 14 to get the second number. So, the second number is: 14 - 8 = 6 C-Program of this task Code---> #include<stdio.h> int main () { int num1 = 8 , num2 , sum = 14 ; num2 = sum - num1 ; printf ( "The second number is: %d" , num2 ); return 0 ; }
In this C++ program we will Create a class ‘STRING’ which has one data member ‘str’. The class can perform concatenation of two string by ‘+’ operator overloading and check given two string are equal or not by ‘==’ operator overloading. Strings will be given by the user.
input:
Two Strings.output:
Either the strings will be equal to each other or not and after that they will be concatenated.
CODE---->
#include<iostream>
#include<string.h>
using namespace std;
class STRING
{
private:
char str[100];
public:
void getString()
{
gets(str);
}
void display()
{
puts(str);
}
STRING operator+(STRING X)
{
STRING s;
strcpy(s.str,str);
strcat(s.str,X.str);
return(s);
}
int operator==(STRING X)
{
if(strcmp(str,X.str)==0)
return 1;
else
return 0;
}
};
int main()
{
STRING s1,s2,s3;
cout<<"Enter 1st String: ";
s1.getString();
cout<<"Enter 2nd String: ";
s2.getString();
cout<<"\n-----------------------\n";
cout<<"1st String is: ";
s1.display();
cout<<"2nd String is: ";
s2.display();
cout<<"\n-----------OUTPUT--------------\n";
if(s1==s2)
cout<<"**String are equal**";
else
cout<<"**String are not equal**";
cout<<"\nConcatenation of given two string is: ";
s3=s1+s2;
s3.display();
}
Download the C-Program file of this Program.
RESULT :
Enter 1st String: You are the Enter 2nd String: best programmer. ----------------------- 1st String is: You are the 2nd String is: best programmer. -----------OUTPUT-------------- **String are not equal** Concatenation of given two string is: You are the best programmer. -------------------------------- Process exited after 72.06 seconds with return value 0 Press any key to continue . . .
Images for better understanding :
Do you understand there's a 12 word phrase you can tell your man... that will trigger intense emotions of love and impulsive appeal for you buried inside his chest?
ReplyDeleteBecause hidden in these 12 words is a "secret signal" that fuels a man's impulse to love, adore and care for you with his entire heart...
12 Words That Trigger A Man's Desire Instinct
This impulse is so hardwired into a man's brain that it will make him try better than ever before to make your relationship as strong as it can be.
In fact, triggering this mighty impulse is absolutely essential to getting the best possible relationship with your man that the instance you send your man one of the "Secret Signals"...
...You'll immediately notice him open his soul and heart to you in such a way he's never expressed before and he will distinguish you as the one and only woman in the world who has ever truly interested him.
Water Hack Burns 2 lb of Fat OVERNIGHT
ReplyDeleteMore than 160k women and men are hacking their diet with a easy and SECRET "liquid hack" to drop 1-2 lbs every night in their sleep.
It is effective and works every time.
You can do it yourself by following these easy steps:
1) Go get a glass and fill it up half glass
2) And now do this strange HACK
and be 1-2 lbs skinnier when you wake up!
Your Affiliate Profit Machine is ready -
ReplyDeleteAnd getting it set up is as easy as 1---2---3!
This is how it all works...
STEP 1. Input into the system what affiliate products the system will advertise
STEP 2. Add PUSH BUTTON traffic (it takes JUST 2 minutes)
STEP 3. Watch the system explode your list and sell your affiliate products on it's own!
Do you want to start making profits?
Your MONEY MAKING affiliate solution is RIGHT HERE