C++- Input Types and Header Files in --Eclipse IDE


  • Reading user's input
  • Create header file
  • Explaining, the preprocessor directives like
    #ifndef, #define and #endif are used in a header file
    to prevent the header files being included
    more than once

Step: 1 Input Type and data type

A a default template was used to create the current project.

Step: 2 Creating a header file

Step: 3 Adding a source file

The above creates an empty source file

Step: 4 Edit codes of the source file.

#include "input1.h"
int main() {
cout << "!!!Hello World!!!" << endl;
// prints !!!Hello World!!!
cout << "!!!Please enter a number!!!" ;
int n1 ; // declaring an integer
cin >> n1;//<<endl;
//cin >> n1;
printf("\n hello : ");
cout << n1 << endl;
return 0;

Step: 5 Build the project and run

The "cin >> n1"  awaits for the users input.

Enter an integer


Step: 6 Final Vision ( Input type and header files)

FYI: this is not an ideal presentation of coding senses, but would be enough to put the concept across the table.