Category : C Source Code
Archive   : CPTUTOR2.ZIP
Filename : MESSAGE.CPP

 
Output of file : MESSAGE.CPP contained in archive : CPTUTOR2.ZIP
// Chapter 1 - Program 3
#include "iostream.h"
#include "string.h"

main()
{
int index;
float distance;
char letter;
char name[25];

index = -23;
distance = 12.345;
letter = 'X';
strcpy(name,"John Doe");

cout << "The value of index is " << index << "\n";
cout << "The value of distance is " << distance << "\n";
cout << "The value of letter is " << letter << "\n";
cout << "The value of name is " << name << "\n";

index = 31;
cout << "The decimal value of index is " << dec << index << "\n";
cout << "The octal value of index is " << oct << index << "\n";
cout << "The hex value of index is " << hex << index << "\n";
cout << "The character letter is " << (char)letter << "\n";
cout << "The value of distance is " << form("%12.4f\n",distance);
cout << form("Hello world!") << "\n";

cout << "Input a decimal value --> ";
cin >> index;
cout << "The hex value of the input is " << index << "\n";
}




// Result of execution
//
// The value of index is -23
// The value of distance is 12.345
// The value of letter is X
// The value of name is John Doe
// The decimal value of index is 31
// The octal value of index is 37
// The hex value of index is 1f
// The character letter is X
// The value of distance is 12.3450
// Hello world!
// Input a decimal value --> 999
// The hex value of the input is 3e7


  3 Responses to “Category : C Source Code
Archive   : CPTUTOR2.ZIP
Filename : MESSAGE.CPP

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/