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

Problem with my program, no output

guys i tried constructing a programe and did but the problem when i run it the screen disappears and no output is presented. I am posting in the question as well as the script which i wrote,please send a reply to me abt it.
question is:
using if statement,to print the roots of a quadratic equation,given the condition as follows:
IF ROOTS
b*b-4*a*c>0 {-b(+/-)sqrt(b*b-4*a*c)}/2*a

b*b-4*a*c=0 {-b/2*a} (msg=roots are equal)

b*b-4*a*c<0 roots are imaginary

script which i had typed:
#include<iostream.h>
#include<conio.h>
#include<math.h>
void main()
{
clrscr();
float a,b,c,r1,d,r2,e;
cout<<"\n enter the values of three no.s";
cin>>a>>b>>c;
d=b*b-4*a*c;
e=sqrt(d);
r1=(-b+e)/(2*a);
r2=(-b+e)/(2*a);
cout<<"\n root1="<<r1;
cout<<"\n root2="<<r2;
if (d>0)
cout<<"\n "<<r2;
else
{
if (d==0)
cout<<"\n roots are equal"<<r1;
}
if (d<0)
cout<<"\n roots are imaginary";
getch();
}
Nov 9 '06 #1
3 1376
Remove GetCh()

and try to get input with ALT+F5


guys i tried constructing a programe and did but the problem when i run it the screen disappears and no output is presented. I am posting in the question as well as the script which i wrote,please send a reply to me abt it.
question is:
using if statement,to print the roots of a quadratic equation,given the condition as follows:
IF ROOTS
b*b-4*a*c>0 {-b(+/-)sqrt(b*b-4*a*c)}/2*a

b*b-4*a*c=0 {-b/2*a} (msg=roots are equal)

b*b-4*a*c<0 roots are imaginary

script which i had typed:
#include<iostream.h>
#include<conio.h>
#include<math.h>
void main()
{
clrscr();
float a,b,c,r1,d,r2,e;
cout<<"\n enter the values of three no.s";
cin>>a>>b>>c;
d=b*b-4*a*c;
e=sqrt(d);
r1=(-b+e)/(2*a);
r2=(-b+e)/(2*a);
cout<<"\n root1="<<r1;
cout<<"\n root2="<<r2;
if (d>0)
cout<<"\n "<<r2;
else
{
if (d==0)
cout<<"\n roots are equal"<<r1;
}
if (d<0)
cout<<"\n roots are imaginary";
getch();
}
Nov 9 '06 #2
sivadhas2006
142 100+
Hi,

Can I know which editor you are using for progamming?

Regards,
M.Sivadhas.
Nov 9 '06 #3
momotaro
357 100+
add this to the end of u r program:
Expand|Select|Wrap|Line Numbers
  1. scanf("%d", &x);
ps: x is your variable that u should declare!
Nov 9 '06 #4

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

Similar topics

9
by: Zoo Keeper | last post by:
For some reason, the Python preprocessing balks on the "\" line continuation character. Any ideas/thoughts? Is it just that my version of gcc is not supported? I don't "need" numeric in my...
6
by: shoo | last post by:
Any one know how to do this? thank Write a simple text-formatting program that produces neatly printed output from input text containing embedded command lines that determine how to format the...
3
by: DrNoose | last post by:
Hi! I'm just getting started learning c++. I have a program that is driving me nuts! I think I have it working all but one portion. Basically, you input a number of "meters" as a double. The...
6
by: shoo | last post by:
Any one know how to do this? thank Write a simple text-formatting program that produces neatly printed output from input text containing embedded command lines that determine how to format the...
2
by: Fernando Barsoba | last post by:
Dear all, I have been posting about a problem trying to encrypt certain data using HMAC-SHA1 functions. I posted that my problem was solved, but unfortunately, I was being overly optimistic. I...
2
by: DC | last post by:
The Code <%@ import namespace="System" %> <%@ import namespace="System.Web" %> <%@ import namespace="System.Web.UI" %> <%@ import namespace="System.Web.UI.HtmlControls" %> <%@ import...
0
by: raa abdullah | last post by:
Overview A conflict-serializbility\recoverability checker, SCR, is a program that takes in a schedule and outputs 2 decisions: Conflict serialzable or Not confilict serializable AND Recoverable or...
0
by: james.mcdonagh | last post by:
Hi I am a newbie using nAnt for .net 2.0. As such I have not come across this bug before, and I would be happy of any help that you may be able to provide. In order to help I have included the...
87
by: pereges | last post by:
I have a C program which I created on Windows machine. I have compiled and executed the program on windows machine and it gives me the consistent output every time i run it. for eg. input a = 2,...
6
by: fido19 | last post by:
Once upon a time, there lived a chimpanzee called Luycha Bandor (aka Playboy Chimp). Luycha was unhappily married to Bunty Mona, a short but cute little lady chimp. Luycha was tall and handsome –...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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...

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.