DirectoryComputersBlog Details for "Unique Technology Blog"

Unique Technology Blog

Unique Technology Blog
Blog About Amazing Computer Technology like home automation, Windows, Linux, Tips and tricks, photoshop etc
Articles: 1, 2, 3, 4, 5

Articles

Function Overloading in C++
2007-03-26 08:57:00
Function overloading : two or more than two function in a program with same name but must be different in parameters.#include<iostream.h>#includ e<conio.h>class demo{public :void add(){int a,b,c;cout <<"enter any number";cin >> a;cout <<"enter any number";cin >>b;c=a+b;cout <<c <<endl;}void add(int a,int b){int c;c=a+b;cout << c <<endl;}};main(){clrscr();int a,b;cin >> a;cin >> b;demo d1;d1.add();d1.add(a,b);getch();}// Here in above program there are two add fuctions. One is of without parameters// and second one is with parameters.
More About: Programs , Over , Load , Function , Loading
File Handling in C++
2007-03-26 08:52:00
File handling : to store data in a text/data fileWriting data to a text file#include<iostream.h>#include<co nio.h>#include<fstream.h> // file streammain(){clrscr();char name[10];int salary;ofstream f("unique"); // output file stream is a class namefor (int i=0; i<=4; i++){cout <<"enter name :";cin >> name;cout << "enter salary :";cin >> salary;f<< name << " " << salary<<endl ;}getch();}// do the following things/*1 run the program2 input some data3 click file menu > dos shell4 type the follwing command at dos prompttype uniqueit will display contents of the unique file.*/
More About: Programs , File , Hand
Exit() function in C++
2007-03-26 08:51:00
exit function : is terminates entire program. Here it is used in for loop when the value of i is eqauls to 100 then exit(0) will be executed and the program will be terminated.#include<iostream.h>#includ e<conio.h>#include<process.h> // requires to include for exit() functionmain(){clrscr();for (int i=1;i<=100; i++){cout << i <<endl;if (i==30)exit(0); // it will termiate entire program}cout << "hello" <<endl; // this statement will never execute.getch();}
More About: Programs , Function
Default Argument Function in C++
2007-03-23 14:11:00
default argument function : In this program function add have two parameters and one of them is default argument and has fix value 10. if this argument is passed when calling this function default value of the function will be omited. If this value is not passed then default valueis used as a function argument.#include<iostream.h>#include& lt;conio.h>class demo{public :void add(int a,int b=10) // value of b is default.{int c=a+b;cout << c <<endl;}};main(){clrscr();demo d1;d1.add(20); // value of b will be 20 and default value if omited.d1.add(); // value of b will be 10 it means default value is used.getch();}
More About: Programs , Fault , Function
Destructor in C++
2007-03-23 13:59:00
destructor : is a member function of a class. it has same name as a class. followed by a tilde sign ~ it does not have return type (neither int nor void) . it automatically get executed when object is destroyed.#include<iostream.h>#include <conio.h>class student // student is a class{public :~student() // destructor{cout <<"Thanx for using this program" <<endl;}};main(){clrscr();student s1; // s1 is an objectgetch();}
More About: Programs
Constructor in C++
2007-03-23 13:52:00
// constructor : is a member function of a class. it must have same name// as a class. it does not have any return type neither int nor void.// it automatically get executed when object is created. it is used to// initialize variables.#include<iostream.h>#include <conio.h>class demo{public :int a,b;demo() // constructor{a=10;b=20;}void add(){int c=a+b;cout << c <<endl;}};main(){clrscr();demo d1;// here object is created d1 of demo class and constructor get called automatically no need to//call it explicitly.d1.add();getch();}
More About: Programs , Const , Cons
IF condition in C++
2007-03-20 11:08:00
IF condition : condition is formed after if keyword in a bracket.if condition is satisfies then only statement within if block will be executed, if condition fails then statement within IF block will not be executed. if there is only one statement within if block then {} bracket can be omited if there are more than one statement within if block then statements of if block must be in {} brackets. If condition is formed using relational operators relational operators :#include<iostream.h>#include<conio .h>main(){clrscr();int a; // variale declarationcout <<"enter any number";cin >> a;if (a>100){cout << "Hello" <<endl;}if (a<100){cout <<"hi" <<endl;}if (a==100){cout <<"bye" <<endl;}if (a!=100){cout <<"Unique" <<endl;}getch();}The above program demonstrates if condition using various relational operators
More About: Programs , Condition , Condi
C++ class program (function with return value)
2007-03-20 11:05:00
C++ class program (function with return value)#include<iostream.h>#include< conio.h>class student // student is a class{public :int add(int a,int b){int c;c=a+b;return c;}};main(){clrscr();student s1;int a,b;cout <<"enter any number";cin >> a;cout <<"enter any number";cin >> b;int c=s1.add(a,b); // calling of a functioncout << c <<endl;getch();}
More About: Programs , Prog , Return , Program , Class
Function with parameter in a class
2007-03-20 11:03:00
C++ (OOP) object oriented programmingfunction with parameter in a class.#include<iostream.h>#include< conio.h>class student{public :void add(int a,int b){int c;c=a+b;cout << c <<endl;}};main(){clrscr();student s1;int a,b,c;cout <<"enter any number";cin >> a;cout <<"enter any number";cin >> b;s1.add(a,b); // calling of a functiongetch();}
More About: Programs , Para , Class , Function , Meter
Functions or Methods in a class
2007-03-20 11:01:00
C++ (OOP) object oriented programmingfunctions in a class : functions in a class are known as methods or member functions#include<iostream.h>#include& lt;conio.h>class student // student is a class{public :void add() // member function{int a,b,c;cout <<"enter any number";cin >> a;cout <<"enter any number";cin >> b;c=a+b;cout << c <<endl;}};main(){clrscr();student s1;s1.add(); // calling of a functiongetch();}
More About: Programs , Functions , Class , Methods , Function
C++ program to demonstrate class and object (OOP)
2007-03-20 10:59:00
class : class is a template for an object. (master copy)object : object is an instance of a class. (photo copy)members of the class are by default private. private means members can not be accessible from anywhere in the prgraom excpet where it is defined.This program to demonstrate C++ class/objectIt will ask user to input roll no., name and marks of a student.#include<iostream.h>#include&l t;conio.h>class student{public :int rn; // data memberschar name[10];float marks;};main(){clrscr();student s1; // s1 is an object.cout <<"enter any roll number";cin >> s1.rn;cout <<"enter name";cin >> s1.name;cout <<"enter any marks";cin >> s1.marks;getch();}
More About: Programs , Prog , Demo , Program , Trat
C++ program to input a character
2007-03-20 10:58:00
This program will accept a character from the keyboard and display it along with hello.#include<iostream.h>#include< conio.h>main(){clrscr();char z;cout << "enter any character";cin >> z;cout << "hello :";cout << z <<endl;getch();}
More About: Programs , Prog , Character , Program , Gram
C++ program to demonstrate single dimensional array
2007-03-20 10:52:00
This program will accept qnantity of item and rate and calculate total amount and net amount.#include<iostream.h>#include< ;conio.h>main(){clrscr();int q[3],p[3],tot[3];int net =0;for(int i=0;i<=2;i++){cout<<"ENTER QUANT. OF ITEMS :";cin>> q[i];cout<<"ENTER RATE IN PER KG :";cin>> p[i];tot[i]= q[i]*p[i];cout<< tot[i] <<endl;net = net + tot[i];}cout << "Grand total is=";cout << net <<endl;getch();}
More About: Programs , Prog , Sing , Demo , Program
Type anywhere in the Microsoft word document
2007-03-19 12:04:00
You can type anywhere in the Microsoft word document simply double click the page area where you want to type. Before doing this make sure that you are working in Page Layout or Web layout view. This facility will work Microsoft 2000 or higher version.
More About: Word , Soft , Type , Here
C++ Program to input/output a matrices
2007-03-19 11:52:00
this program will take input for two 3x3 matrices m and n and then print them in matrix format and then it will add two of the matrix and store the result in third matrix (o).#include<iostream.h>#include<co nio.h>main(){clrscr();int m[3][3]; // matrix delcarationint n[3][3];int o[3][3];for (int i=0;i<=2;i++) // first matrix input{for (int j=0;j<=2;j++){cout <<"enter any number";cin >> m[i][j];}}for (i=0;i<=2;i++) // first matrix output{for (int j=0;j<=2;j++){cout << m[i][j]<<" ";}cout <<endl;} // second matrix inputfor (i=0;i<=2;i++){for (int j=0;j<=2;j++){cout <<"enter any number";cin >> n[i][j];}}for (i=0;i<=2;i++) // second matrix output{for (int j=0;j<=2;j++){cout << n[i][j]<<" ";}cout <<endl;}for (i=0;i<=2;i++) // adding both of the matrix{for (int j=0;j<=2;j++){o[i][j] = m[i][j] + n[i][j];}cout <<endl;}for (i=0;i<=2;i++) // outputing the answer{for (int j=0;j<=2;j++){cout << ...
More About: Programs , Prog , Program , Matrices , Gram
C++ Program to design a admission form using Graphics
2007-03-19 11:49:00
#include<iostream.h>#include<conio. h>#include<graphics.h>main(){int driver,mode;driver=DETECT;initgraph (&driver,&mode,"");moveto(250,2);sett extstyle(1,HORIZ_DIR,4);outtext("B A B A");line(205,38,420,38);moveto(200,40);se ttextstyle(1,HORIZ_DIR,2);outtext("COMPUT ER EDUCATION");moveto(330,80);settextstyle(1 ,HORIZ_DIR,2) ;outtext("ADDMISSION FORM ") ;setcolor(15) ;rectangle(80,80,510,110);setfillstyle(1, 2);floodfill(388,100,15);gotoxy(4,10);cou t<<"Date of add. :-";gotoxy(4,11);cout<<"Name :-";gotoxy(4,12);cout<<"Course :-";gotoxy(4,13);cout<<"Father's Name :-";gotoxy(4,14);cout<<"Date Of Birth :-";gotoxy(4,15);cout<<"Address :-";gotoxy(4,16);cout<<"City :-";gotoxy(4,17);cout<<"Tel.no. :- (O) (R) ";gotoxy(4,18);cout<<"Qualification No:-";gotoxy(26,19 );cout<<" 10 12 Graduate Other/ Subjects";gotoxy(4,20);cout<<"Compu ter Qual. :-";gotoxy(4,21);cout<<"Institution :-";gotoxy(4,23);cout<<"I DECLARE T...
More About: Graphics , Design , Programs , Prog , Miss
C++ Program to demonstrate single dimensional array
2007-03-19 11:47:00
array : array is a group of elements of same data types. single dimensional array. this program will accepts 5 students marks and store them into an array m and then it will total them. array always start with 0. means first element always be 0.#include<iostream.h>#include<coni o.h>main(){clrscr();int m[5];int tot=0;for (int i=0;i<=4;i++){cout <<"enter any marks";cin >> m[i];tot = tot + m[i];}cout << tot <<endl;cout << tot/5 <<endl;getch();}
More About: Programs , Prog , Sing , Demo , Program
More articles from this author:
1, 2, 3, 4, 5
47214 blogs in the directory.
Statistics resets every week.


Contact | About
© Blog Toplist 2008 - Supported by Web Catalog - SEO by FeWorks
eXTReMe Tracker