--------------------------------------------------------------- MYHEADER.H void function(char a[]) { cout << a; } save - C:\TURBOC3\INCLUDE --------------------------------------------------------------- //P-14 : Create own header file #include <iostream.h> #include <conio.h> #include <myheader.h> void main() { clrscr(); function("This is "); function("Simple Header file"); getch(); }
Posts
Showing posts with the label Basic consept of cpp
- Get link
- X
- Other Apps
//P-12: Function overloading #include <iostream.h> #include <conio.h> void show() { cout << "Function show() without argument" << endl; } void show(int a) { cout << "\nFunction show() with one argument" << endl; cout << "Number : " << a << endl; } void show(int n, char nm[]) { cout << "\nFunction show with two argument" << endl; cout << "Number : " << n << endl; cout << "String : " << nm << endl; } void main() { clrscr(); show(); show(65); show(36,"Welcome to function overloading"); getch(); }
- Get link
- X
- Other Apps
//P-6: scope resolution operator :: #include <iostream.h> #include <conio.h> int n = 100; void main() { int n = 50; clrscr(); { int n = 25; cout << "\nblock -1" << endl; cout << "N = " << n << endl; cout << "::N = " << ::n << endl; } { int n = 10; cout << "\nblock -2" << endl; cout << "N = " << n << endl; cout << "::N = " << ::n << endl; } cout << "\nmain function" << endl; cout << "N = " << n << endl; cout << "::N = " << ::n << endl; getch(); }