C++

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." <<...
>>

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...
>>

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...
>>

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 << " is " <<...
>>

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

  Click here for C++ PROGRAM #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 <<...
>>
<< 1 | 2 | 3 | 4 | 5

Search site

Copyright © 2012 Dadaso Zanzane. All rights reserved.