Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsOtherProgramming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old October 29th, 2009, 12:25 AM
mrzbuddy mrzbuddy is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Oct 2009
Posts: 1 mrzbuddy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 16 m 33 sec
Reputation Power: 0
Access Programming - Having trouble writing a program

1. Write a c++ program to decide if the coefficients of a quadratic equation have real roots. The three choices will be to write the message "zero divide" when A is zero, write the message "No real roots" if the discriminant is negetive and find the two roots when there is no error condition. Do not find the roots if there is an error condition.
2. Use Nested decision to do the three parts of the algorithm above.
3. Write a sentinel controlled loop while loop based on a charector value to control the loop. 'q' or 'Q' will terminate the loop; any other value will continue processing. Read the value from the keyboard and write to the monitor. Use the inputs given below. Do not use a do-while loop. If the first input is 'q' the program should bypass the loop.
4. Document the program properly. Be sure to set the isoflags, setprecision and showpoint. Use a setprecision of 3. Also use setw for each numeric output.
5. Libraries needed; iostream, cmath, iomanip. (add the .h, math.h for older compilers.

Sample input: For charector variable, and A, B, and C respectivly.

T 2.0 -3.0 -7.0
T 0.0 5.5 1.3
K 3.0 -1.0 10.0
Q // the sentinel value

Sample output: The two roots are -1.266 and 2.766(first input above)
Zero divide(second input above)
No real roots(third input above)

Inputs: M 0.0 -1.4 4.9
K 3.0 -2.0 -5.0
T 2.0 3.0 4.0
Q

Output: as described above, there should be 3 seperate answers.


I got this but wont work blah im so terrible at c++ :/

#include <iostream>
#include <iomanip>
#include "cmath" //im guessing this is some type of external .h

double a,b,c,answ,d;

void GetEqn()
{
char chk;
for (int x=1; x<=3; x++)
{
std::cin>>chk;
if (chk == 'q' || chk == 'Q')
goto stop; //Stops program if enabled

std::cout<<"Please input a: ";
std::cin>>a;
std::cout<<"Please input b: ";
std::cin>>b;
std::cout<<"Please input c: ";
std::cin>>c;
answ=b*b;
answ-=4*a*c;
if(answ>0)
d=1;
//cout
if(answ=0)
d=0;
//cout
if(answ<0)
d=-1;
//cout
}
stop:
std::cout<<"Quitted";
}

int main()
{
return 0;
}

Reply With Quote
Reply

Viewing: ASP Free ForumsOtherProgramming Help > Access Programming - Having trouble writing a program


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump





 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 4 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek