473,511 Members | 15,503 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

New to programing keep getting error. Please help!

1 New Member
Okay so I'm in a intro to programming class and for an assignment we're supposed to develop a program that gives the ingredients for fruit punch and convert the normal service size to a service size of 240,000. The teacher gave us an example on how to do it, I modified it and still get errors. Errors like syntax errors not including ";" and another one saying : "There is no context in which this conversion is possible". Here's my code:

Expand|Select|Wrap|Line Numbers
  1.  
  2. #include <iostream>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.   double cupsOfSlicedStrawberries: 2.0;
  8.   double cupsOfWater: 2.0;
  9.   double ouncesOfFrozenPinkLemonadeConcentrate: 12.0;
  10.   double ouncesOfFrozenSweetenedSlicedStrawberies: 10.0;
  11.   double ouncesOfFrozenOrangeJuiceConcentrate: 6.0;
  12.   double litersOfLemonLimeSoda: 2.0;
  13.   double ammountCanServe: 14.0;
  14.  
  15.   double mustServe: 240000.0;
  16.  
  17.   cupsOfSlicedStrawberries = cupsOfSlicedStrawberries / ammountCanServe * mustServe;
  18.   cupsOfWater = cupsOfWater / ammountCanServe * mustServe;
  19.   ouncesOfFrozenPinkLemonadeConcentrate = ouncesOfFrozenPinkLemonadeConcentrate / ammountCanServe * mustServe;
  20.   ouncesOfFrozenSweetenedSlicedStrawberies = ouncesOfFrozenSweetenedSlicedStrawberies / ammountCanServe * mustServe;
  21.   ouncesOfFrozenOrangeJuiceConcentrate = ouncesOfFrozenOrangeJuiceConcentrate / ammountCanServe * mustServe;
  22.   litersOfLemonLimeSoda = litersOfLemonLimeSoda / ammountCanServe * mustServe;
  23.  
  24.   cout << endl;
  25.   cout << "Recipe for " << mustServe << " Sweetheart Punches" << endl;
  26.   cout << "--------------------------------------------------" << endl;
  27.   cout << "cupsOfSlicedStrawberries: " << cupsOfSlicedStrawberries << endl;
  28.   cout << "cupsOfWater: " << cupsOfWater << endl;
  29.   cout << "ouncesOfFrozenPinkLemonadeConcentrate: " << ouncesOfFrozenPinkLemonadeConcentrate << endl;
  30.   cout << "ouncesOfFrozenSweetenedSlicedStrawberies: " << ouncesOfFrozenSweetenedSlicedStrawberies << endl;
  31.   cout << "ouncesOfFrozenOrangeJuiceConcentrate: " << ouncesOfFrozenOrangeJuiceConcentrate << endl;
  32.   cout << "litersOfLemonLimeSoda: " << litersOfLemonLimeSoda << endl;
  33.   cout << endl;
  34.  
  35.   return 0;
  36.  
  37. }
  38.  
  39.  
Sep 7 '12 #1
1 1642
weaknessforcats
9,208 Recognized Expert Moderator Expert
Expand|Select|Wrap|Line Numbers
  1. double cupsOfSlicedStrawberries: 2.0;
Use = instead of : to assign value

Expand|Select|Wrap|Line Numbers
  1. double cupsOfSlicedStrawberries = 2.0;
There is a : operator but it's not used like this so your compiler generates a general error message. However, the line number should appear on the error. That identifies when the compiler knew it was in trouble. The actual error may be on that line or perhaps an earler line.
Sep 8 '12 #2

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

Similar topics

1
2999
by: Shabbs | last post by:
hi I am getting this error message :- Run-time error 713 Class not registered Looking for object with CLSID:{20DD1B9E-87C4-11D1-8BE3-0000F8754DA1} when ever i click on components which i...
1
1923
by: Vernon | last post by:
Hi anyone, This is my code. int num num = 0; for(int a=0; a<count; ++a){ if(current->transID==aNo) ++num; current = current->next;
4
2689
by: Chefry | last post by:
I'm trying to set up an off the shelf script and keep getting an error. My host set up the mysql on my site and I changed the variables I had to in the settings.php file but I keep getting the...
2
2018
by: iainw | last post by:
HI All, 1st post here, i wonder if you can help. We are about to upload CMS t a windows server and keep getting 2 errors below. We need to go LIVE an it's delaying us. An error occured when...
2
3780
by: partybob99 | last post by:
I am trying to call SP_Password from some vb.net code. This should be very straight forward but no matter what I do, I keep getting errors. Here is the code strConnectString = "Data Source=" +...
8
6262
by: lawrence k | last post by:
I've installed Apache 1.3.36 on my Redhat EL 3 machine. Now I'm trying to install PHP 5.1.4. I can not get the ./configure command to work. I keep getting this error: configure: error: Invalid...
0
1178
by: CAIBird | last post by:
hi, i've been developing a webservice on machine A and one WebMethod of this webservice will connect to SQL Server2000 on machine B using a connect string defined in Web.config as below: <add...
3
2132
by: Wendy Chilkotowsky | last post by:
When I try to validate my page http://www.doe.k12.de.us/dev/pcs/businessmarketing.shtml in the W3 validator I keep getting the error Here is the code: <div id="pageTitle"> <!-- PAGE...
8
5850
by: illuzion | last post by:
ok I keep getting this error: Parse error: syntax error, unexpected T_VARIABLE in /home/illuzion/public_html/BAMF/contactus.php on line 38 and this error is possibly on other lines could...
5
2152
by: hpailles | last post by:
I keep getting this error, could somebody help? <?php if ((!$_POST) || (isset($_GET)){ //haven't seen the form, so show it $display_block = " <form method=\"post\"...
0
7242
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7138
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7418
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...
1
7075
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
5662
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5063
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
3212
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
781
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
446
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.