Computer problems,Computer help
*AX SOFT>>>Programming & Design

If anyone has any experience with programming, specifically C++, can you help me with a simple script error?


Ok, so my calculator script works at first, when it asks for 1 number, then when it asks if I should add, subtract, etc, the second number is automatically set to a whack number. please help :D

My script (first part, i think the error is at the end, plus I just copy and pasted my script over for -, *, and /):
#include<iostream>
using namespace std;

int main(void)
{

system("TITLE My little Calcy, FO");
system("COLOR 2");
char cChar;
double dfirstnumber;
double dsecondnumber;
char cDoagain;

do
{

system("CLS");
cout << "Insert the first number"
<< endl;
cin >> dfirstnumber;
cout << "Enter the operation you would like to complete"
<< " (+,-,*, or /)" << endl;
cin >> cChar;

cout << "Enter 2nd number, hurry up also, I don't have all day"
<< endl;

switch (cChar)
{
case '+' :
cout << "The answer is..." << dfirstnumber << " + " << dsecondnumber << " = " << (dfirstnumber + dsecondnumber)
<< endl;
break;

When you asked for the second number, you forgot to read in their answer? cin >> dsecondnumber?

Tags
  General - Computers & Internet   Software   Security   Programming & Design   Facebook   Flickr   Google   MSN   MySpace
Related information
  • How can i animate words using imageready?

    Dear Neri, I will try to make it as simple as possible. Create 3 layers in photoshop. In layer one type your text using a big thick font. Duplicate this layer and rotate this text anticlockwi...

  • Is it normal to have a small php.ini file? 4kb?

    The default php.ini file (in PHP 5) is much larger, closer to 50kb. However, that is due to it being full of comments. A file that only contains actual items and no comments could get that low.

  • Help! Css/HTML!?

    The site you have listed does this with Java script, which I have disabled so it became very obvious very quickly what was being used. You can do that using java but you can also do it with CSS! NO...

  • Can you open your disk drive with a sript command?

    Some time ago, a friend of mine sent me a link to a web site. When I clicked on it, it scared the hell out of me, because all CD drives started to open on my computer. That site is long gone (t...

  • C++: How do I set my file name as a variable so I can open whatever file I want during execution of program?

    void open ( const char * filename, ios_base::openmode mode = ios_base::in ); Your file name must be of type const char *. Your variable "Variable" must be a string since you are usi...

  • What is the demand for web designers and coders for the next decade?

    It's looking really good dude! You don't even have to go to college for this field since most of it is available through the internet for free.

    ...
  • I want to learn a programming language. Where should I start, and can you recommend some books?

    The comment above about learning how to program is spot on. Once you know how to program and understand the concepts, the knowledge is pretty well transferable to all languages. A great place f...

  • Borland C++ compiler problems.?

    Sounds like a bad character in the hello.cpp file, probably on line 2. Note that the bad character may not display. I suggest retyping the line exactly as it appears, then deleting the origin...

  •  

    Categories--Copyright/IP Policy--Contact Webmaster