Quantcast
Viewing all articles
Browse latest Browse all 24

C++ Programming Tutorial Chapter One

Chapter 1 - Programming exercise 1
File format : CH01_1.CPP, Save That.



#include <iostream.h>

main()
{

   for (int index = 0 ; index < 3 ; index++) {
      cout << "John Doe\n";
      cout << "Jan 1, 1955\n\n";
   }
}

Chapter 1 - Programming exercise 2
File format : CH01_2.CPP,save That.
 

#include <iostream.h>

main()
{
const index = 17;
volatile count;

   count = index + 12;
   index = count + 3;
}







                 
Chapter 1 - Programming exercise 3
 File format : CH01_3.CPP.Save That 
#include <iostream.h>

void main(void)
{
int month, day, year;

   cout << "Enter your birth month ---> ";
   cin >> month;
   cout << "Enter your birth day -----> ";
   cin >> day;
   cout << "Enter your birth year ----> ";
   cin >> year;

   cout << "Birthday(octal)       = "<< oct <<
                       month << "/"<< day << "/"<< year << "\n";
   cout << "Birthday(decimal)     = "<< dec <<
                       month << "/"<< day << "/"<< year << "\n";
   cout << "Birthday(hexadecimal) = "<< hex <<
                       month << "/"<< day << "/"<< year << "\n";
}

Viewing all articles
Browse latest Browse all 24

Trending Articles