Click here to Skip to main content
15,797,721 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hey i want that when i enter the choice i.e 2 then next screen pops up in same console and show me the answer or output !! i am little amateur help me out with this guys !!!

What I have tried:

#include <iostream>

using namespace std;

int sum(int &a, int &b)
	int add = 0;
	a = a + b;
	add = a;
	return add;
int subt(int &g, int &h)
	int sub = 0;
	g = g - h;
	sub = g;
	return sub;
int mult(int &a, int &b)
	int mul = 0;
	a = a * b;
	mul = a;
	return mul;
int divi(int &a, int &b)
	int div = 0;
	a = a / b;
	div = a;
	return div;
void main()
	int a = 100;
	int b = 20;
	int c = 0;
	int d = 0;
	int e = 0;
	int f = 0;
	cout << "Enter Your Choice= " << endl;
	int choice;
	cin >> choice;
	switch (choice)
	case 1:
		c = sum(a, b);
		cout << "Summation Results= " << c << endl;
	case 2:
		c = subt(a, b);
		cout << "Subtraction Results= " << c << endl;
	case 3:
		c = mult(a, b);
		cout << "Multiplication Results= " << c << endl;
	case 4:
		c = divi(a, b);
		cout << "Division Results Results= " << c << endl;
Updated 1-Feb-17 23:29pm
CPallini 12-Dec-16 6:10am    
There is no 'next screen' in a console application. What is wrong with your current program?
mayashah 12-Dec-16 8:39am    
there is nothing wrong i just want that when i call certain function it shows answer in other tab / screen of console !!
CPallini 12-Dec-16 8:44am    
To see another console you have to launch a new process.
mayashah 12-Dec-16 10:23am    

see the video from 0:16 => 0:25
the thing which is happening here i want this !!
Philippe Mori 12-Dec-16 16:43pm    
Learn to write code that make sense. For example, your sum function should look like:

int sum(int a, int b)
    return a + b;

All the other extra stuff is either useless or bad.

You have only one screen for output, so you need to write it all on one screen.

Teh common way (in every output as printing or drawing) is to compute the coordinates where every character (or drawing element) of output and draw it there. Here you can adding blank spaces or tabs, where needed.

Take also a look at this article and this one.
Share this answer
mayashah 12-Dec-16 8:42am    
basically i have seen this is some program on YouTube !! so i have this anxiety to do so !!
After seeing your comments I understand that you are talking about clearing the console before printing the output. Pass clear screen command to your console.
case 2:
c = subt(a, b);
cout << "Subtraction Results= " << c << endl;
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900