This is a Simple C++ code for a converter program that converts energy into mass according to the famous equation from greatest scientist Albert Einstein. E= MC2
Input energy in MeV( Mega electron volt), GeV( Giga electron volt) or in Tev( Tera electron volt).
You can use visual c++ compiler for compiling and running program. You can find the Source code below. if you are using Borland turbo C++ don’t use “using namespace std;” and insert .h extension for iostream, iomanip header files. Moreover, it will not support “system(“CLS”);” and replace it by “clrscr();”
E= MC2: –
E = Energy
M = Mass
C = speed of light in vacuum (299792458 m/s)
Let’s imagine the practical use of this equation. Consider just a stone, which weigh 250g. If you convert it completely into energy, then the total energy from the mass;
E = 0.250(kg) x 89875517873681764 (c x c)
= 22468879468420441 J
#include<iostream>
#include<Windows.h>//for_sleep()
#include<iomanip>
#include<process.h> //for_exit()_function;
#include<conio.h>
using namespacestd;
void main()
{ system(“color f1”); //making_colour_combinations
double consteV=1.60219e-19;
double constc2=9*10e16; //c^2;
int ch; //for_input
double e, mass;
start: //For_returning_into_main_menu
system(“CLS”);
cout<<“tt***********************************************n”;
cout<<“tt ENERGY – MASS CONVERTER : UNIT CHOICE MENUn”;
cout<<“tt***********************************************n”;
cout<<“nn 1. MeV (Mega Electrone Volts)n 2. GeV (Giga electrone volts)n 3. TeV (Tera Electrone Volts) n 4. Exit”;
cout<<“nn Please Enter Your Choice :”;
cin>>ch;
system(“CLS”); //Clear_screen_command
switch(ch)
{
case 1:
cout<<“ntt ENERGY-MASS CONVERTER ( E = mc^2 )”;
cout<<“nnnnPlease enter energy in MeV :”;
cin>>e;
e=e*10e6*eV; // Energy Converted into Joules
mass=e/c2;
cout<<“nnntttMass = “<<setprecision(10)<<mass<<” Kilograms”;
break;
case 2:
cout<<“tttENERGY-MASS CONVERTER ( E = mc^2 )”;
cout<<“nnnnPlease enter energy in GeV :”;
cin>>e;
e=e*10e9*eV; // Energy Converted into Joules
mass=e/c2;
cout<<“nnntttMass = “<<setprecision(10)<<mass<<” Kilograms”;
break;
case 3:
cout<<“tttENERGY-MASS CONVERTER ( E = mc^2 )”;
cout<<“nnnnPlease enter energy in TeV :”;
cin>>e;
e=e*10e12*eV; // Energy Converted into Joules
mass=e/c2;
cout<<“nnntttMass = “<<setprecision(10)<<mass<<” Kilograms”;
break;
case 4 : system(“CLS”);
cout<<“nnttttThank you………..”;
Sleep(1000);
exit(0);
default: cout<<“naInvalid Choice !….nnPlease Try again.”;
break;
} // End of switch
if(_getch()) //wait_for_any_input_through_keyboard
goto start;
return;
}
____________________________________________________________
… [Trackback]
[…] Find More on on that Topic: genuinecoder.com/energy-mass-converter-program-c-cpp-html/ […]
… [Trackback]
[…] Read More Info here on that Topic: genuinecoder.com/energy-mass-converter-program-c-cpp-html/ […]
… [Trackback]
[…] Find More here on that Topic: genuinecoder.com/energy-mass-converter-program-c-cpp-html/ […]
… [Trackback]
[…] Find More Info here to that Topic: genuinecoder.com/energy-mass-converter-program-c-cpp-html/ […]
… [Trackback]
[…] Information to that Topic: genuinecoder.com/energy-mass-converter-program-c-cpp-html/ […]
… [Trackback]
[…] Read More Information here to that Topic: genuinecoder.com/energy-mass-converter-program-c-cpp-html/ […]
… [Trackback]
[…] Info to that Topic: genuinecoder.com/energy-mass-converter-program-c-cpp-html/ […]
… [Trackback]
[…] Info to that Topic: genuinecoder.com/energy-mass-converter-program-c-cpp-html/ […]
… [Trackback]
[…] Information to that Topic: genuinecoder.com/energy-mass-converter-program-c-cpp-html/ […]
… [Trackback]
[…] Find More Information here to that Topic: genuinecoder.com/energy-mass-converter-program-c-cpp-html/ […]
… [Trackback]
[…] There you can find 73970 additional Info to that Topic: genuinecoder.com/energy-mass-converter-program-c-cpp-html/ […]
… [Trackback]
[…] Find More on to that Topic: genuinecoder.com/energy-mass-converter-program-c-cpp-html/ […]
… [Trackback]
[…] Read More on to that Topic: genuinecoder.com/energy-mass-converter-program-c-cpp-html/ […]
… [Trackback]
[…] Here you will find 59495 additional Info to that Topic: genuinecoder.com/energy-mass-converter-program-c-cpp-html/ […]
… [Trackback]
[…] Find More to that Topic: genuinecoder.com/energy-mass-converter-program-c-cpp-html/ […]
… [Trackback]
[…] Find More on on that Topic: genuinecoder.com/energy-mass-converter-program-c-cpp-html/ […]
… [Trackback]
[…] Read More here on that Topic: genuinecoder.com/energy-mass-converter-program-c-cpp-html/ […]
… [Trackback]
[…] There you will find 19540 additional Info on that Topic: genuinecoder.com/energy-mass-converter-program-c-cpp-html/ […]
… [Trackback]
[…] Read More Info here on that Topic: genuinecoder.com/energy-mass-converter-program-c-cpp-html/ […]
… [Trackback]
[…] Read More to that Topic: genuinecoder.com/energy-mass-converter-program-c-cpp-html/ […]
… [Trackback]
[…] Here you will find 45957 more Information to that Topic: genuinecoder.com/energy-mass-converter-program-c-cpp-html/ […]
… [Trackback]
[…] Information to that Topic: genuinecoder.com/energy-mass-converter-program-c-cpp-html/ […]
… [Trackback]
[…] Read More Info here to that Topic: genuinecoder.com/energy-mass-converter-program-c-cpp-html/ […]
… [Trackback]
[…] Read More on that Topic: genuinecoder.com/energy-mass-converter-program-c-cpp-html/ […]
… [Trackback]
[…] Read More to that Topic: genuinecoder.com/energy-mass-converter-program-c-cpp-html/ […]
… [Trackback]
[…] Read More on to that Topic: genuinecoder.com/energy-mass-converter-program-c-cpp-html/ […]
… [Trackback]
[…] Find More on to that Topic: genuinecoder.com/energy-mass-converter-program-c-cpp-html/ […]
… [Trackback]
[…] Read More on that Topic: genuinecoder.com/energy-mass-converter-program-c-cpp-html/ […]
… [Trackback]
[…] Find More here to that Topic: genuinecoder.com/energy-mass-converter-program-c-cpp-html/ […]
… [Trackback]
[…] Find More Information here on that Topic: genuinecoder.com/energy-mass-converter-program-c-cpp-html/ […]
… [Trackback]
[…] Info on that Topic: genuinecoder.com/energy-mass-converter-program-c-cpp-html/ […]
… [Trackback]
[…] Here you will find 80403 more Info to that Topic: genuinecoder.com/energy-mass-converter-program-c-cpp-html/ […]
… [Trackback]
[…] Read More on that Topic: genuinecoder.com/energy-mass-converter-program-c-cpp-html/ […]
… [Trackback]
[…] Here you can find 14794 additional Information to that Topic: genuinecoder.com/energy-mass-converter-program-c-cpp-html/ […]
… [Trackback]
[…] Find More Info here on that Topic: genuinecoder.com/energy-mass-converter-program-c-cpp-html/ […]
… [Trackback]
[…] Find More to that Topic: genuinecoder.com/energy-mass-converter-program-c-cpp-html/ […]
… [Trackback]
[…] There you can find 1029 more Info on that Topic: genuinecoder.com/energy-mass-converter-program-c-cpp-html/ […]
… [Trackback]
[…] Find More on that Topic: genuinecoder.com/energy-mass-converter-program-c-cpp-html/ […]
… [Trackback]
[…] Info to that Topic: genuinecoder.com/energy-mass-converter-program-c-cpp-html/ […]
… [Trackback]
[…] Read More Information here to that Topic: genuinecoder.com/energy-mass-converter-program-c-cpp-html/ […]