Categories

Tags

Octal Decimal Hexadecimal conversions method 2

#include

int main()
{
cout

Octal Decimal Hexadecimal conversions

#include
#include

int main()
{
cout

Launch notepad

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

int main(void)
{

cout

An if elese example

#include
#include

int main()
{
double radius;
//get user input
coutradius;
//act on user input
if(radius < 0.0)
cout

A cin.getline example

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

int main(void)
{
const SIZE = 100;
char msg[SIZE];
cout

Fahrenheit to celsius example

#include

int main()
{
double fahr , celsius;
coutfahr;
//convert to celsius
celsius = (5.0 / 9.0) * (fahr – 32.0);
cout

A setw example

//illustrates setting cout width

#include
#include
#include

int main()
{

cout

Another file example

#include
#include

int main()

{
// first lets output to a file
ofstream fout(“sample.txt”);
fout str;
fin.close();
//display sample.txt contents
cout

A file example

#include
#include
const char *FILENAME = “myfile.txt”;

int main()
{
//create output object associated w/ file
ofstream fout(FILENAME);
cout > str;
//write the text to the file
fout

A cout.width example

//illustrates setting the minimum
//output width using the width member
#include
#include

int main()
{
int i;
for(i=0;i