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

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

Simple Addition in C++ Binary Operator Overloading Using C++ Programming

// Header Files #include<iostream> #include<conio.h> //Standard namespace declaration using namespace std; class overloading { int value; public: void setValue(int temp) { value = temp; } overloading operator+(overloading ob) { overloading t; t.value=value+ob.value; return(t); } void display() { cout<<value<<endl; } }; //Main Functionsint main() { overloading obj1,obj2,result; int a,b; cout<<“Enter the value of Complex Numbers a,b:”; … Read more

Simple Example Program for Function Find Smallest Number In C++

#include<iostream> #include<conio.h> using namespace std; // Simple Function int compare( int a, int b ) { return (a+4 < b)? a : b; } int main() { cout<<”\nSmallest Number :”<<compare(1,10); cout<<”\nSmallest Number :”<<compare(31,10); cout<<”\nSmallest Number :”<<compare(11,8); getch(); return 0; }   Output : Smallest Number :1 Smallest Number :10 Smallest Number :8