Search
Syndication
Sponsors

Archive for the ‘C plus plus’ Category

Octal Decimal Hexadecimal conversions method 2

Wednesday, March 11th, 2009

#include

int main()
{
cout<<"The decimal value of 15 is "<<15< cout<<"The octal value of 15 is "< cout<<"The hex value of 15 is "<

return 0;

}

Octal Decimal Hexadecimal conversions

Tuesday, March 10th, 2009

#include
#include

int main()
{
cout<<"The decimal value of 15 is "<<15< cout<<"The octal value of 15 is "< cout<<"The hex value of 15 is "<

return 0;

}

Launch notepad

Monday, March 9th, 2009

/**************************************
launch notepad C++ version
***************************************/
#include
#include

int main(void)
{

cout<<"Explorer will launch.n"< /*replace with the path to your explorer.exe*/
system(”h:\windows\explorer.exe”);

return 0;
}

An if elese example

Sunday, March 8th, 2009

#include
#include

int main()
{
double radius;
//get user input
cout<<"Please enter the radius : ";
cin>>radius;
//act on user input
if(radius < 0.0)
cout<<"Cannot have a negative radius"< else
cout<<"The area of the circle is "<<3.1416 * pow(radius,2)<

return 0;
}

A cin.getline example

Friday, March 6th, 2009

/**************************************
cin.getline example
***************************************/
#include

int main(void)
{
const SIZE = 100;
char msg[SIZE];
cout<<"Enter a string."< cin.getline(msg,SIZE);
cout<<"The sentence you entered was"< cout<

return 0;
}

Translate
Tags