Mar 30, 2007

Inkers

Inkers is a provider of a toner and inkjet printer cartridges (generic or compatible). They provide high quality ink cartridges for your Laser printer, Inkjet printer, multifunction printer and fax machines.

They says "One best thing to purchase from them is they give guarantee against defect for one year and a 30 days no question ask money back guarantee they give.
It is an cost effective alternative.

Inkers delivers free ground shipping and usually they deliver same day of orders
If you need any kind of guidance from them feel free to call them at their toll free number before 2PM Pacific at 800-848-7232 and they will be glad to guide you through. they always love to help your queries about ink cartrides.

So when you think about ink cartridges think about Inkers.
READ MORE - Inkers

Mar 26, 2007

C++ program for Password input and check

C++ program to input and check a given password. if user input a correct password then program to add two number will be executed and a user input a wrong password. A message "Wrong password" would appeared on the screen and terminates the proram.

#include<iostream.h>
#include<conio.h>
main()
{
clrscr();
for (int i=1;i<=5;i=i+1) // start, condition, increment
{
int a,b,c,x;
cout << "enter your password here";
cin >> x ;
if (x==1)
{\
cout <<"enter first number";
cin >> a;
cout <<"enter second number";
cin >> b;
c=a+b;
cout << c <<endl;
}
else
{
cout << "wrong password";
break;
}
}
getch();
}

READ MORE - C++ program for Password input and check

Inheritance In C++

C++ program to demonstrate inheritance :
#include<iostream.h>
#include<conio.h>
class demo1 // base class
{
public :
void hello()
{
cout << "hello FROM DEMO1" <<endl;
}
};

class demo2 : public demo1 // derived class
{
public :
void hi()
{
cout << "hi FROM DEMO2" <<endl;
}
};

main()
{
clrscr();
demo2 d2;
d2.hello();
d2.hi();
getch();
}

READ MORE - Inheritance In C++

Function Overloading in C++

Function overloading : two or more than two function in a program with same name but must be different in parameters.
#include<iostream.h>
#include<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.

READ MORE - Function Overloading in C++

File Handling in C++

File handling : to store data in a text/data file
Writing data to a text file

#include<iostream.h>
#include<conio.h>
#include<fstream.h> // file stream

main()
{
clrscr();
char name[10];
int salary;
ofstream f("unique"); // output file stream is a class name

for (int i=0; i<=4; i++)
{
cout <<"enter name :";
cin >> name;

cout << "enter salary :";
cin >> salary;
f<< name << "\t" << salary<<endl ;
}
getch();
}

// do the following things
/*
1 run the program
2 input some data
3 click file menu > dos shell
4 type the follwing command at dos prompt
type unique
it will display contents of the unique file.
*/

READ MORE - File Handling in C++

Exit() function in C++

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>
#include<conio.h>
#include<process.h> // requires to include for exit() function
main()
{
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();
}

READ MORE - Exit() function in C++

Mar 23, 2007

Default Argument Function in C++

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 value
is used as a function argument.

#include<iostream.h>
#include<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();
}

READ MORE - Default Argument Function in C++

Destructor in C++

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 object
getch();
}

READ MORE - Destructor in C++

Constructor in C++

// 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();
}

READ MORE - Constructor in C++

Mar 20, 2007

IF condition in C++

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 declaration
cout <<"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

READ MORE - IF condition in C++

C++ class program (function with return value)

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 function
cout << c <<endl;
getch();
}

READ MORE - C++ class program (function with return value)

Function with parameter in a class

C++ (OOP) object oriented programming
function 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 function
getch();
}

READ MORE - Function with parameter in a class

Functions or Methods in a class

C++ (OOP) object oriented programming
functions in a class : functions in a class are known as methods or member functions

#include<iostream.h>
#include<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 function
getch();
}

READ MORE - Functions or Methods in a class

C++ program to demonstrate class and object (OOP)

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/object
It will ask user to input roll no., name and marks of a student.

#include<iostream.h>
#include<conio.h>
class student
{
public :
int rn; // data members
char 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();
}

READ MORE - C++ program to demonstrate class and object (OOP)

C++ program to input a character

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();
}

READ MORE - C++ program to input a character

C++ program to demonstrate single dimensional array

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();
}

READ MORE - C++ program to demonstrate single dimensional array

Mar 19, 2007

Type anywhere in the Microsoft word document

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.
READ MORE - Type anywhere in the Microsoft word document

C++ Program to input/output a matrices

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<conio.h>
main()
{
clrscr();
int m[3][3]; // matrix delcaration
int 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 input

for (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 << o[i][j] << " ";
}
cout <<endl;
}

getch();
}

READ MORE - C++ Program to input/output a matrices

C++ Program to design a admission form using Graphics

#include<iostream.h>
#include<conio.h>
#include<graphics.h>
main()
{
int driver,mode;
driver=DETECT;
initgraph (&driver,&mode,"");
moveto(250,2);
settextstyle(1,HORIZ_DIR,4);
outtext("B A B A");
line(205,38,420,38);
moveto(200,40);
settextstyle(1,HORIZ_DIR,2);
outtext("COMPUTER 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);
cout<<"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<<"Computer Qual. :-";
gotoxy(4,21);
cout<<"Institution :-";
gotoxy(4,23);
cout<<"I DECLARE THAT I SHALL BE ABIDE BY THE LAWS OF THE INSTITUTION";
gotoxy(60,25);
cout<<"SIGNATURE";
line(180,155,500,155);
line(180,170,500,170);
line(180,185,500,185);
line(180,200,500,200);
line(180,215,500,215);
line(180,230,500,230);
line(180,245,500,245);
line(180,335,500,335 );
line(180,320 ,500,320 );
rectangle(215,255,280,270);
rectangle(320,255,385,270);
rectangle(530,6,630,110);
rectangle(2,0,638,478);
getch();
}

READ MORE - C++ Program to design a admission form using Graphics

C++ Program to demonstrate single dimensional array

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<conio.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();
}

READ MORE - C++ Program to demonstrate single dimensional array

C++ Program to input age to find out teen, young or old

This program will accept age from the user and according to age appropriate message would be display like baby , child , teenager, young or old. In this program I have used Logical operator (and operator)

#include<iostream.h>
#include<conio.h>
main()
{
clrscr();
int age;
cout<<"enter the age in year(s)";
cin>>age;
if (age<1)
{
cout << "invalid age";
}

if(age>=1 && age<=3)
{
cout<<"baby"<<endl;
}

if(age>3 && age<=12)
{
cout<<"child"<<endl;
}

if(age>=13 && age<20)
{
cout<<"teenager"<<endl;
}

if(age>=20 && age<=45)
{
cout<<"young"<<endl;
}

if(age>45)
{
cout<<"old"<<endl;
}

getch();
}
READ MORE - C++ Program to input age to find out teen, young or old

C++ program to add, subtract, multiply and divide two given numbers

#include<iostream.h>
#include<conio.h>
main()
{
clrscr();
int a,b;
cout <<"enter any number";
cin >> a;
cout <<"enter any number";
cin >> b;
int c=a+b;
cout << c <<endl;
int d=a-b;
cout << d <<endl;
int e=a*b;
cout <<e <<endl;
int f=a/b;
cout << f <<endl;
getch();
}

READ MORE - C++ program to add, subtract, multiply and divide two given numbers

C program to add two given numbers

how-to-add-two-numbers-in-c-languageIn C language how to add two given integer numbers I will show you this by a simple example.It will add two integer values. Every C program must have a main() function. then your program will be in starting curly bracket { and } ending curly bracket. Here we want to add two numbers a and b and result of addition will be stored in c. So here we declare three integer variables a,b & c. clrscr() function is a clear screen function that will clears the screen. printf() function will print a message "enter any number" on the screen to the user to input a number from the keyboard. scanf() function is used to input a value from the keyboard. When this statement is executed then user has to input a value from the keyboard. Value input by the keyboard will be stored in variable a. Same way value of b is to be stored into variable b. In scanf() function, we have used %d format string. %d is for integer means we have to input a integer from the keyboard. other format string are as follows that can be used in the program.
Format Strings:

%d - integer

%f - float

%c - character

Then we come to the statement c=a+b. This statement will add the value of a and b and store into variable c. then printf() statement will print the value of c variable on the screen. Here + is an arithmetic operator. More arithmetic operators can be used such as - (subtract), * (Multiply), / (Divide), % (Mod or Remainder). getch() statement is a get character statement. It pause the output until user presses a key from the keyboard.

#include<stdio.h> // standard input output header file
#include<conio.h>
main()
{
int a,b,c;
clrscr();
printf("enter any number");
scanf("%d",&a); // or cin >> a
printf("enter any number");
scanf("%d",&b);
c=a+b;
printf("%d",c);
getch();
}

Other C & C++ Programs:

READ MORE - C program to add two given numbers

Mar 13, 2007

C++ program to draw concentric circles

C++ program to generate concentric circles. Here For loop will give radius (i) to circle function and each time it will increment by 5.Delay function will slow down the process to print the concentric circles on the screen. For initgraph() function and circle() function graphics.h header file is used the function initgraph() will convert text mode to graphics mode and closegraph() again converts graphics screen into text mode.In initgraph function third parameter is path of BGI files where graphics files are located. If the graphics driver files are other than this directory than type that path as a third parameter in initgraph() function. Many time we run a graphics program and often a BGI error occurres. It is related to this path of BGI files. Give correct path of BGI files in initgraph() function. If you don't know the path of BGI files then find *.BGI files by find option in winodws and you will be known the correct path.

#include<iostream.h>
#include<conio.h>
#include<graphics.h>
#include<dos.h>

main()
{
clrscr();
int driver,mode;
driver = DETECT;
initgraph(&driver,&mode,"C:\TC\BGI");
for(int i=1;i<=50;i=i+5)
{
circle(100,100,i);
delay(100);
}
getch();
closegraph();
}
READ MORE - C++ program to draw concentric circles

Mar 12, 2007

C++ program to generate 10 random numbers between 1 to 100

C++ program to generate random numbers between 1 and 100. For random() function, stdlib.h header file is required. randomize() function will generate different random numbers each time you run the program. If you don't include radomize() function it will generate same random numbers whenever you run this program.
#include<iostream.h>
#include<conio.h>
#include<stdlib.h>
main()
{
clrscr();
randomize();
for(int i=1;i<=10;i++)
{
cout << random(100)<<endl;
}
getch();
}
READ MORE - C++ program to generate 10 random numbers between 1 to 100

Mar 7, 2007

What is an action in Photoshop?

Actions are set of commands that you have to record once and playback any number of times according to your need. Just suppose you have 100 photographs and you want to change the size of all of the photographs so you can create an action of if and apply to all of 100 photographs so you do not need to change the size of all of your photograph manually Photoshop will do it automatically for you. Or we take another example here if you want to make an array of passport photo means picture package so you can once record an action for it and then within a few seconds you will create picture package by using recorded action in future. In short we can say an action is a set of commands that can be played any number of times.

Most of the commands can be included in actions but some are not.

Start Photoshop and then click “Window > Show Actions”. It will display action palette as shown below.

READ MORE - What is an action in Photoshop?

Mar 5, 2007

C++ Program to count vowels in given string

C++ program to count vowels in a string. This program will ask user to input a string of maximum 40 characters and then it will count vowels in the given string.
#include<iostream.h>
#include<conio.h>
#include<stdio.h>
main()
{
int i;
clrscr();
char st[40];
cout<<"Enter Any String Maximum 40 Characters";
gets(st);
i=0;
for (int k=0;st[k]!='\0';k++)
{
if(st[k]=='a' st[k]=='A' st[k]=='e'
st[k]=='E' st[k]=='i' st[k]=='I'
st[k]=='o' st[k]=='O'st[k]=='u'
st[k]=='U')
i++;
}
cout<<endl<<"The of Vowels in this string is = "<<i;
getch();
}
READ MORE - C++ Program to count vowels in given string

C++ Program to find out largest of three given numbers

C++ program to find out largest of three given numbers. The program will accept three numbers and then print the largest of three numbers. In this program if statement is used with and (&&) operator.


#include<iostream.h>
#include<conio.h>
main()
{
clrscr();
int a,b,c;
cout<<"Enter Value of A : ";
cin>>a;
cout<<"Enter Value of B : ";
cin>>b;
cout<<"Enter Value of C : ";
cin>>c;
if (a>b && a>c)
cout<<endl<<"The largest no. is A";
if (b>a && b>c)
cout<<endl<<"The largest no. is B";
if (c>a && c>b)
cout<<endl<<"The largest no. is C";
getch();
}
READ MORE - C++ Program to find out largest of three given numbers

C++ Program to count uppercase, lower case and numbers in given string

C++ program to count upper case, lower case and numbers in given string. This program will accept a string. then it will count uppercase alphabets(capital letters), small alphabets (lower case letters) and numbers too. Type this in your favourite C++ editor and check it out.

#include<iostream.h>
#include<conio.h>
#include<stdio.h>
main()
{
clrscr();
char st[40];
int u,l,d,o,i;
u=i=d=o=l=0;
cout<<"Enter a string maximum 40 characters";
gets(st);
for (i=0;st[i]!='\0';i++)
{
if(st[i]>=65 && st[i]<=90)
u++;
if(st[i]>=97 && st[i]<=122)
l++;
if(st[i]>=48 && st[i]<=57)
d++;
}
cout<<endl<<"The Total upper case characters is : "<<u;
cout<<endl<<"The Total lower case characters is : "<<l;
cout<<endl<<"The Total digit is : "<<d;
getch();
}
READ MORE - C++ Program to count uppercase, lower case and numbers in given string

Mar 2, 2007

C++ program to generate a table from any given number upto any given number

// or C++ program to generate a table between a given range.
// in this program there will be two input num1 and num2 and table will be
// generated between given num1 and num2.
#include<iostream.h>
#include<conio.h>
main()
{
clrscr();
int num1,num2;
cout <<"enter first number";
cin >> num1;
cout <<"enter second number";
cin >> num2;
for (int i=num1;i<=num2;i++)
{
for(int k=1;k<=10;k++)
{
cout << i*k<<endl;
}
getch();
}
getch();
}
Write above program in c++ editor and run. Give first input 2 and second input 5
then table will be generated from 2 to 5.

READ MORE - C++ program to generate a table from any given number upto any given number

Infolinks In Text Ads

Total Pageviews

Powered by Blogger.

Dont Forget To Follow Us

Blog Archive