473,396 Members | 1,866 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,396 software developers and data experts.

command prompt window disappears before output

this is my program, it works fine when asking for inputs, but as soon as i press enter for the output the window just dissapers.

Expand|Select|Wrap|Line Numbers
  1. #include<stdio.h>
  2. main()
  3. {int bno;
  4.  float sv,tax;
  5.  
  6. clrscr();
  7.  printf("\n\n\t Enter Bill Number:");
  8.  scanf("%d",&bno);
  9.  printf("\n\n\t Enter Sale Value:");
  10.  scanf("%f",&sv);
  11.  
  12. if(sv<=100000)
  13.   tax=sv*0.09;
  14.   else
  15.    if(sv<=350000)
  16.      tax=(sv-100000)*0.12+9000;
  17.      else
  18.       tax=(sv-350000)*0.15+39000;
  19.  
  20. clrscr();
  21.  printf("\n\n\t Bill Number:%d",bno);
  22.  printf("\n\n\t For Sales Value Rs.%.2f.",sv);
  23.  printf("\n\n\t Sales Tax Amount Calculation is as follows:");
  24.  
  25. if(sv<=100000)
  26.   printf("\n\n\t Sales Tax=%.2f*0.09=%.2f",sv,tax);
  27.   else
  28.    if(sv<=350000)
  29.      printf("\n\n\t Sales Tax=(%.2f-100000)*0.12+9000=%.2f",sv,tax);
  30.      else
  31.       printf("\n\n\t Sales Tax=(%.2f-350000)*0.15+39000=%.2f",sv,tax);
  32.  }
Jan 14 '13 #1
2 1479
Rabbit
12,516 Expert Mod 8TB
Please use code tags when posting code.

Add a line at the end to scan for a final input. So they can choose when to exit by hitting enter.
Jan 14 '13 #2
leecorp
10
Just Type in getch();
At the end of the code Before closing the Program "}"

Or

Just Put some Scanf() Code
For Example

scanf("%f",&sv);

At the end of the code Before closing the Program "}"

Then the Screen Wont Exit
Jan 15 '13 #3

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

Similar topics

0
by: Laura Zeafla via .NET 247 | last post by:
I used the .NET forms application wizard. From the form youclick a button and it calls a C++ function through its dll. This function is supposed to pop-up a command prompt window. Something about...
2
by: Mustaq | last post by:
Hi, I have an application in VB.NET which runs from command prompt, I need output message in the same command prompt window, Example D:\Mustaq\ORC\Orc 3.7\Insertor\Insertor\bin>insertor.exe ...
2
by: Luca Paganelli | last post by:
Hi everybody. I've got a simple but bothering problem. I've just written a little application in C#. I've got a set of business logic classes and a window forms GUI released as a set of...
1
by: Aftab Alam | last post by:
Hello All I wonder why the Dos Window appears in back ground if we make a managed c++ application how can I stop it in MSDN samples there is a sample caculator which is made in managed cpp but it...
1
by: Jay Feldman | last post by:
I've seen some messages about the screen flashing black for a few moments when executing a program in vb.net this may be because the command prompt settings were changed. when the command prompt...
6
by: academic | last post by:
What is the convention for Command Window arguments? If I write a program called QQQ that takes one argument should I expect a user to type: QQQ arg QQQ -arg QQQ /arg or what?
1
by: Lana rose | last post by:
Is there a way of hiding the command prompt window when executing some code in C++ that needs no input from the reader? it is simply a piece of code that reads some data from one file and...
0
by: shanmugam | last post by:
Hi All How can i hide the command prompt window when executing the system command in perl. Thanks in advance Shanmugam
1
by: jlatessa | last post by:
So I'm trying to pipe the output of a small diagnostic program to a txt file. I run the command "IPT.exe -v >test.txt" which runs the program in verbose and pipes the output to test.txt, however...
2
by: mcfly | last post by:
I can apply my python code using import tkinter within the python shell and it works perfectly (i open some file using tkinter). however, when i try to run the file.py from the command prompt...
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: 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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.