473,406 Members | 2,710 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,406 software developers and data experts.

Why am I recieving this error C2061: identifier 'cout' while trying to complile?

Expand|Select|Wrap|Line Numbers
  1.  #include <iostream>
  2. #include <iomanip>
  3. #include <string>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9.     //declare variables
  10.     string name = " ";
  11.     double saleAmount = 0.0;
  12.     double shippingCharge = 0.0;
  13.  
  14.     // ask  user for input
  15.     cout << "Plese Enter sales amount: ";
  16.     cin >> saleAmount;
  17.     cout << endl << endl;
  18.  
  19.     // calculate shipping charge
  20.     cout << "Calculating shipping charge" << endl;
  21.     if (saleAmount > 5,000.00)
  22.         (shippingCharge = 20.00  + saleAmount);
  23.     else if (saleAmount > 1000.01 && saleAmount <= 5000.00)
  24.         (shippingCharge = 15.00 + saleAmount);
  25.     else if (saleAmount > 500.01 && saleAmount <= 1000.00)
  26.         (shippingCharge = 10.0 + saleAmount);
  27.     else if (saleAmount > 250.01 && saleAmount <= 500.00)
  28.         (shippingCharge = 8.00 + saleAmount);
  29.     else if (saleAmount > 0.00 && saleAmount <= 250.00)
  30.         (shippingCharge = 5.00 + saleAmount);
  31.     else if 
  32.  
  33. [error]    cout << endl << endl;
  34.     // output
  35.     cout << name << ", your shipping charge is " << shippingCharge << endl;
  36.     cout << setprecision(2) << fixed;
  37.     cout << "Your shipping charge is $" << shippingCharge + saleAmount << endl;
I keep recieving the error code listed below while trying to compile my program, this simple error is causing me nothing but angst trying to figure out what the problem is. If someone could point what the flaw is in my program code I would be forever grateful.
Nov 8 '10 #1
2 3331
You omitted the control expression for the "else if" just before that cout.

Expand|Select|Wrap|Line Numbers
  1. else if (saleAmount > 0.00 && saleAmount <= 250.00)
  2. (shippingCharge = 5.00 + saleAmount);
  3. else if  // <== error is here
  4.  
  5. [error] cout << endl << endl;
  6. // output
  7. cout << name << ", your shipping charge is " << shippingCharge << endl;
  8. cout << setprecision(2) << fixed;
  9. cout << "Your shipping charge is $" << shippingCharge + saleAmount << endl;
Nov 8 '10 #2
Thank you very much for the help, sometimes it takes an extra set of eyes to see where you have gone off course. Once again thank you very much, your assistance was invaluable.
Nov 8 '10 #3

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

Similar topics

0
by: MWK | last post by:
Hi All, I don't understand why I get "error c2061: syntax error : identifier" in VS2003. I thought it's fixed in .Net 2003: __hook(&TCP_Client::LineReceived, client, HandlerLineReceived); ...
2
by: aarthi28 | last post by:
Hi, I have this code that I am trying to compile, but I am getting the following errors 'CoInitializeSecurity': identifier not found 'EOAC_NONE' : undeclared identifier I have pasted the...
6
by: Pixel.to.life | last post by:
So I have this perfectly fine and running app, that uses managed C++ forms. Problem#1: I pass a Bitmap reference to a class, hoping to modify it in one of the class's methods, so it reflects...
15
by: madhu.ab | last post by:
Hi All, I am getting the following errors when i am including header file winuser.h I dont know whats happening. How will an error occur in winuser.h?? Please help. \microsoft visual...
6
by: muby | last post by:
Hi everybody :) I'm modifying a C++ code in VC++ 2005 my code snippet void BandwidthAllocationScheduler::insert( Message* msg, BOOL* QueueIsFull,
5
by: nina01 | last post by:
Hi! I'm working on a mini compiler with flex and bison. The ".l" and ".y" files are generated successfully. However, when I try to compile the hole thing using the command "gcc -o comp comp.tab.c...
6
by: rahulsengupta895 | last post by:
. #define MIN(a,b) (a<b?a:b) #define MAX(a,b) (a>b?a:b) #include "Video.h" #define NO_HUE -1
1
by: bals3239 | last post by:
I am using a program called putty to write basic programs in C/ C++ for an introduction to computer programming class. I am very new at programming and am just getting started writing very simple...
2
shashahayes
by: shashahayes | last post by:
I am getting an error on this line, does anyone have any suggestions? here is the error here is line 25 if area > 750 then charge = 200 1>Furniture.cpp
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?
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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...
0
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
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...

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.