## Program to enter an integer and print if it is greater or less than 100

#include <iostream.h> #include <conio.h> void main(){ clrscr(); int x; cout << “Enter an integer : ” << endl; cin>>x; if(x>100) { cout << x << ” is greater than 100.” << endl; } else { cout << x << ” is less than 100.” << endl; } getch(); }   This program takes in … Read more

## Program to enter your age and print if you should be in grade 10

#include <iostream.h> #include <conio.h> void main() { clrscr(); int age; cout << “Enter your present age : ” << endl; cin>>age; if(age==16) { cout << “Your present age is ” << age << ” years.” << endl; cout << “You are of the right age for joining grade 10 !” << endl; } else … Read more

## Program to enter velocity, acceleration and time and print final velocity using the formula : v = u + a * t

#include <iostream.h> #include <conio.h> void main() { clrscr(); int v,u,a,t; cout << “Enter the velocity, acceleration, time as integers : ” << endl; cin>>u>>a>>t; v=u+a*t; cout << “The final velocity is ” << v << “.” << endl; getch(); }   This program takes in the velocity, acceleration and the time as a screen … Read more

## Program to enter two integers and find their sum and average

#include <iostream.h> #include <iostream.h> #include <conio.h> void main() { clrscr(); int x,y,sum; float average; cout << “Enter 2 integers : ” << endl; cin>>x>>y; sum=x+y; average=sum/2; cout << “The sum of ” << x << ” and ” << y << ” is ” << sum << “.” << endl; cout << “The average of … Read more

## C++ Program to find the sum, difference, product and quotient of two integers

#include <iostream.h> #include <conio.h> void main() { clrscr(); int x = 10; int y = 2; int sum, difference, product, quotient; sum = x + y; difference = x – y; product = x * y; quotient = x / y; cout << “The sum of ” << x << ” & ” << y … Read more

## C++ Program to output an integer, a floating point number and a character

#include <iostream.h> #include <conio.h> void main() { clrscr(); int x = 10; float y = 10.1; char z = ‘a’; cout << “x = ” << x << endl; cout << “y = ” << y << endl; cout << “z = ” << z << endl; getch(); }   This program has pre-defined … Read more

## C++ program which adds two integers

#include <iostream.h> main() { // A simple C++ program int x, y, sum; cout << “A program which adds two integers\n”; cout << “Enter 1st integer: “; cin >> x; cout << “Enter 2nd integer: “; cin >> y; sum = x + y; cout << “Sum is ” << sum << endl; return 0; … Read more

## Simple Program Book Entry Using structure Variable in C++ Programming

#include<iostream.h> #include<stdio.h> struct books { char name[20],author[20]; }a[50]; int main() { int i,n; cout<<“No Of Books[less than 50]:”; cin>>n; cout<<“Enter the book details\n”; cout<<”–––––––-\n”; for(i=0;i<n;i++) { cout<<“Details of Book No “<<i+1<<”\n”; cout<<“Book Name :”; cin>>a[i].name; cout<<“Book Author :”; cin>>a[i].author; cout<<”–––––––-\n”; } cout<<”================================================\n”; cout<<” S.No\t| Book Name\t|author\n”;cout<<”=====================================================”; for(i=0;i<n;i++) { cout<<”\n ”<<i+1<<”\t|”<<a[i].name<<”\t| “<<a[i].author; } cout<<”\n=================================================”; return 0; … Read more