473,387 Members | 1,465 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Command Box Disappears just after showing number without me clicking anything !!

I just started learning C and wanted to try and make something, i know its small but i'm still learning. So I made a small prog that will add two numbers that we put and after showing the result it disappears fast!!! Suddenly!!! I want it to stay till we click enter so i added a getchar() at the then end but still same thing happens!!! that's it:

Expand|Select|Wrap|Line Numbers
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4.  int main()
  5. {
  6.      int numb1 = 
  7.      printf("Please Enter a Numb: ");
  8.      scanf("%i", &numb1);
  9.      int numb2 = 
  10.      printf("Please enter a sec numb: ");
  11.      scanf("%i", &numb2);
  12.      printf("%i", numb1+numb2);
  13.      getchar();
  14.     }
Apr 24 '14 #1
2 1197
weaknessforcats
9,208 Expert Mod 8TB
Are you using Visual Studio by any chance?
Apr 24 '14 #2
Luk3r
300 256MB
I'm not fluent in C/C++, nor am I telling you that this is the correct way to do this. But this worked for my test

Add this include:
Expand|Select|Wrap|Line Numbers
  1. #include <iostream>
Add this immediately after printf("%i", numb1+numb2);:
Expand|Select|Wrap|Line Numbers
  1. std::cin.get();
Apr 25 '14 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Pieter Linden | last post by:
In Access 2000, I would have sworn I could see the controltiptext of a button without clicking on it. Can this still be done in AccessXP? If so, does someone have a code snippet showing how to do...
1
by: Li Pang | last post by:
Hi, I'd like to know the easiest way to get a row number when clicking on a listview. Thanks
1
by: veg_all | last post by:
I am often surprised to see many websites require that the credit card not be entered with any spaces or dashes. This is very trivial to remove those characters that I wonder about the security of...
3
by: friday13 | last post by:
Hi, I would like to set the link's "visited" pseudo-class with javascript without clicking on the link. My goal is to update the link's color (previously set in the CSS file) to be "visited"...
2
by: Milkstr | last post by:
I have a page with a form, a couple of hidden fields and a submit button, the information in the hidden fields i want to submit automatically without clicking the submit button, is there a way of...
38
by: ted | last post by:
I have an old link that was widely distributed. I would now like to put a link on that old page that will go to a new page without displaying anything.
4
by: savitabca | last post by:
how to write a code to reverse an number without using % and /
2
by: pavanip | last post by:
Hi, I have one web page in that i am using one anchor tag and linking to some other page in Anchor href. Now i want to raise anchor click event automatically in page load without clicking and...
7
by: Suprim | last post by:
I am using a timer to call a random number range from 1 to 50 and display it in a label. How can i display the number without repeating the number that have been call out? For example, if number...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.