how to write program in cpp enter the principal, rate & time and print the simple interest

Hello friends, Welcome to your Techgsr.co blog. And today in this article we will learn about how to write program in cpp enter the principal, rate & time and print the simple interest.So let’s go to our topic #include <iostream.h> #include <conio.h> void main() { clrscr(); int x; float sinterest,principal,rate,time; for(x=4;x>=0;x—) { cout << “Enter the … Read more

How to write Program switch between different cases in cpp

Hello friends, Welcome to your Techgsr.co blog. And today in this article we will learn about How to write Program switch between different cases in cpp .So let’s go to our topic #include <iostream.h> #include <conio.h> int main() { clrscr(); int choice; cout << “1. Talk” << endl; cout << “2. Eat” << endl; cout << “3. … Read more

how write program to enter a string and find its length in cpp

Hello friends, Welcome to your Techgsr.co blog. And today in this article we will learn about how write program to enter a string and find its length in cpp .So let’s go to our topic #include <iostream.h> #include <conio.h> #include <string.h> void main() { clrscr(); int slength; char x[81]; //Allowing the user to input a maximum … Read more

Program to enter an integer and output the cube of that integer

#include <iostream.h> #include <conio.h> int cube(int x); //The prototype. void main() { clrscr(); int a; cout << “Enter an integer : “; cin>>a; cout << “The cube of ” << a << ” is : ” << cube(a) << endl; //Call the function cube(a). getch(); } //Defining the function. int cube(int x) { int y; … Read more

Program to enter an integer and print out its successor

#include <iostream.h> #include <conio.h> void value(int); void main() { clrscr(); int x; cout << “Enter an integer : “; cin>>x; cout << “The successor of ” << x << ” is “; value(x); getch(); } void value(int x) { x++; cout << x << “.” << endl; }   This program takes in an integer … Read more

Program to enter three integers and output the biggest integer using IF

Hello friends, Welcome to your Techgsr.co blog. And today in this article we will learn about  Program to enter three integers and output the biggest integer using IF .So let’s go to our topic #include <iostream.h> #include <conio.h> int main() { clrscr(); int x,y,z,biggest; cout << “Enter 3 integers : “; cin>>x>>y>>z; biggest=x; if(y>biggest) biggest=y; if(z>biggest) … Read more

Program to change the background colors on the screen

  #include <conio.h> #include <graphics.h> #include <stdlib.h> #include <stdio.h> void main (int) { int gdriver=DETECT,gmode,errorcode; //Requesting auto-detection. int midx,midy,x; //Initializing graphics and local variables. initgraph(&gdriver,&gmode,“d:\bc3\bgi”); //Reading result of initialization. errorcode=graphresult(); if(errorcode!=grOk) //An error occurred. { printf(“Graphics error occurred : %s \n”,grapherrormsg(errorcode)); printf(“Press any key to stop : “); getch(); exit(1); //Terminate the program due to … Read more

Program to enter three integers and output the biggest integer

  #include <iostream.h> #include <conio.h> int main() { clrscr(); int x,y,z,biggest; cout << “Enter 3 integers : “; cin>>x>>y>>z; biggest=x>y?(x>z?x:z):(y>z?y:z); cout << “The biggest integer out of the 3 integers you typed “; cout << x << “, ” << y << ” & ” << z << ” is : ” << “\n” << … Read more