Converting Temperature from Centigrade to Fahrenheit c++ | Swapping Values Without Using Third Variables in c++
Converting Temperature | Swapping Values in C++ |
Converting Temperature from Centigrade to Fahrenheit
Hi Friends! my name is ABID ALI owner and admin @Onlinebloggertricks.com, i am here with a programming post in which we shall learn about two things
1st one is Converting temperature from centigrade to Fahrenheit
so follow is the code given to convert temperature just do practice and learn programming
2nd one is swapping values without the help of third variable
its code is also given below so do same and practice in case of any confusion and misunderstanding of any thing then please send us feedback at contact us forum or use our comment forum to leave your comments
thanks for reading us
1st one is Converting temperature from centigrade to Fahrenheit
so follow is the code given to convert temperature just do practice and learn programming
2nd one is swapping values without the help of third variable
its code is also given below so do same and practice in case of any confusion and misunderstanding of any thing then please send us feedback at contact us forum or use our comment forum to leave your comments
thanks for reading us
Swapping Values Without Using Third Variables
Swapping Values Without Using Third Variables |
#include<iostream>#include<math.h>using namespace std;int main(){
float t,c,f;cout<<"Enter Centigrade to Convert in Fahrenheit=";cin>>c;t=c*1.8+32;cout<<"Formula=c*9/5+32"<<"\n";cout<<"Converted Temperature="<<t<<"\n";system("pause");
}
Swapping Values Without Using Third Variables |
#include<iostream>
#include<conio.h>
using namespace std;
int main ()
{ //swapping without the help of third veriable
int x, y, z;
x=5, y=6;
cout<<"Value of X="<<x<<"\n";
cout<<"Value of Y="<<y<<"\n";
x=x+y, y=x-y, x=x-y;
cout<<"Swapped Value of X="<<x<<"\n";
cout<<"Swapped Value of Y="<<y<<"\n";
cout<<"\n";
//Want User to Enter Value for Swapping ?? Try the Code Below
cout<<"Hi!!! You Ready to Swap than\n";
cout<<"\n";
cout<<"Enter X to Swap=";
cin>>x;
cout<<"Enter Y to Swap=";
cin>>y,
x=x+y;
y=x-y;
x=x-y;
cout<<"Swapped Value of X="<<x<<"\n";
cout<<"Swapped Value of Y="<<y<<"\n";
system("pause"); cout<<"Thanks You Swapped Successfully";
}
COMMENTS