473,385 Members | 1,312 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.

I have 8 errors I can't find? Help than post the correct code please.

Heres the code:
:)



Expand|Select|Wrap|Line Numbers
  1. #include<iostream>
  2.  
  3.  
  4. int main{void}
  5.  
  6.  
  7. {
  8.     system{"TITLE Calculator"};
  9.     system {" COLOR 7"};
  10.     char cChar;
  11.     double dfirstnumber;
  12.     double dsecondnumber;
  13.     char cDoagain;
  14.  
  15. do 
  16. {
  17.    system{"CLS"};
  18.    cout << " Please enter your first number"
  19.    <<endl;
  20.    cin >> dfirstnumber;
  21.    cout << "Please enter the operator"
  22.    << "{+,-,*,or /}" <<endl;
  23.    cin >> cChar;
  24.  
  25.    cout << "Please enter the second number"
  26.    <<end1;
  27.    switch {cChar}
  28.    {
  29.    case "+"
  30.         cout << "The answer is"
  31.         << dfirstnumber << "+" <<dsecondnmber
  32.         << "=" << {dfirstnumber + dsecondnumber}
  33.         <<endl;
  34.         break;
  35.            case "-"
  36.         cout << "The answer is"
  37.         << dfirstnumber << "-" <<dsecondnmber
  38.         << "=" << {dfirstnumber - dsecondnumber}
  39.         <<endl;
  40.         break;
  41.            case "*"
  42.         cout << "The answer is"
  43.         << dfirstnumber << "*" <<dsecondnmber
  44.         << "=" << {dfirstnumber * dsecondnumber}
  45.         <<endl;
  46.         break;
  47.            case "X"
  48.         cout << "The answer is"
  49.         << dfirstnumber << "X" <<dsecondnmber
  50.         << "=" << {dfirstnumber * dsecondnumber}
  51.         <<endl;
  52.         break;
  53.            case "x"
  54.         cout << "The answer is"
  55.         << dfirstnumber << "x" <<dsecondnmber
  56.         << "=" << {dfirstnumber * dsecondnumber}
  57.         <<endl;
  58.         break;
  59.            case "/"
  60.            if(dsecondnumber == 0}
  61.            cout << " That is an invalid operation"
  62.            << endl;
  63.  
  64.            }else{
  65.         cout << "The answer is"
  66.         << dfirstnumber << "/" <<dsecondnmber
  67.         << "=" << {dfirstnumber / dsecondnumber}
  68.         <<endl;
  69.         break;
  70.         }
  71.         default: cout << "That is an invalid operation."
  72.         break;
  73.         }
  74.  
  75.  
  76.         Cout << "Would you like to do the program again? (yes or no)"
  77.         << endl;
  78.         cin >> cdoagain;
  79.         }while [cdoagain == "yes" || cdoagain == "Yes"
  80.  
  81.         system{"PAUSE"};
  82.         return 0;
  83.         }
May 11 '10 #1
4 1378
Banfa
9,065 Expert Mod 8TB
How do you know you have 8 errors? If you mean you have 8 compiler errors why haven't you posted them?

Generally if you want a favour, like someone diagnosing your code for you, it is a good idea to provide the maximum amount of information you can.

In a lot of, but not all, cases you appear to be using { } where you should be using ( ), I would say you have more than 8 errors.
May 11 '10 #2
whodgson
542 512MB
for example yes and Yes does not cover all the options. What about YES?
May 12 '10 #3
newb16
687 512MB
Do not use strings ( in double quoes, like "+" ) as a case for switch with a char variable, it should be '+'.
May 12 '10 #4
Dheeraj Joshi
1,123 Expert 1GB
Where is
Expand|Select|Wrap|Line Numbers
  1. cin >> dsecondnmber;
  2.  
in your code?

Regards
Dheeraj Joshi
May 12 '10 #5

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

Similar topics

5
by: Donnie Leen | last post by:
I make program in c++ embedding python2.4 in windows, I need the python24_d.lib to link with the debug version of my program, but i can't find the source code to build python24_d.lib on the...
2
by: MLH | last post by:
I cut a mail function off the m'soft site. Has always worked. However, I would like to include error codes returned by the sendmail Fn and be able to understand what they mean. I had my first...
18
by: Mike Bartels | last post by:
Hi Everyone! I have two Arrays A and B. Both arrays are byte arrays with 7 bytes each. The contents of array A and B are the same A = {1, 2, 3, 4, 5, 6, 7}; B = {1, 2, 3, 4, 5, 6, 7}; When...
7
by: Nadav | last post by:
Hi, 1. I am writing some kind of a CLI Linker 2. I am using the unmanaged meta-data API. I wonder browsing "cor.h" I have encountered the 'ICeeGen' this interface is retrieved by the...
2
by: hooterbite | last post by:
I am using an object datasource to call a stored procedure to update an SQL table. THE STORED PROCEDURE WORKS FINE! THE OBJECTDATASOURCE WORKS FINE! When the textbox is inside a standard HTML tag...
2
by: Pucca | last post by:
Where can I find pre-defined Error code like OBJECT_ALREADY_EXISTS (HRESULT) for the DirectoryServicesCOMException.ErrorCode? I need it for the try-catch coding. Thanks.
1
by: bitong | last post by:
what's wrong with my work? Pls help #include <stdio.h> int subtractor (int x, int y); main() { int a=5; int d=93; int s; s=subtractor(a,d);
9
by: Tony Girgenti | last post by:
Hello. I'm developing and testing a web application using VS.NET 2003, VB, .NET Framework 1.1.4322, ASP.NET 1.1.4322 and IIS5.1 on a WIN XP Pro, SP2 computer. I'm using a web form. For a...
0
MMcCarthy
by: MMcCarthy | last post by:
If you posted a question in this forum and it's now missing it is because it has been moved to a more appropriate forum. To find your question click on the 'Control Panel' link on the top right of...
0
by: =?Utf-8?B?Sm9l?= | last post by:
This may seem a little silly but please bear with me... I have a page called Page1.aspx and a code behind Page1.aspx.cs. In the code behind I declare a class called OdsDataSource as a CHILD...
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: 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:
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: 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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

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.