473,387 Members | 1,757 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,387 software developers and data experts.

I'm getting error C2088 and error C2040. I don't know how to fix them

Hello, I'm getting 2 errors with my code, and I need help clearing them out. Here's my code

Expand|Select|Wrap|Line Numbers
  1. #include <iostream>
  2. #include <fstream>
  3. #include <iomanip>
  4. #include <string>
  5. #include <sstream>
  6. #include <string.h>
  7. using namespace std;
  8.  
  9. string FileName;
  10. void starline();
  11. float balance;
  12. float deposit;
  13. float check;
  14. double m; 
  15.  
  16. void starline() //function declarator
  17. {
  18. for(int j=0; j<65; j++) //function body
  19. cout << '-';
  20. cout << endl;
  21. }
  22.  
  23.  
  24. int main()
  25. {
  26.     cout << "Enter a file name (including extension): " << endl;
  27.     char FileName[300];
  28.     cin.getline (FileName,300);
  29.     ifstream input(FileName);
  30.  
  31.     if (!input.good())
  32.     {
  33.         cerr << "Unable to open file" << endl;
  34.         exit(1);
  35.     }
  36.  
  37.     while (!input.eof())
  38.     {
  39.         starline();
  40.         char    deposit[15];
  41.         input.getline(deposit, 15, ':');
  42.         cout << left << setw(15) << deposit;
  43.  
  44.         char    date[15];
  45.         input.getline(date, 15, ':');
  46.         cout << setw(15) << date;
  47.  
  48.         char    place[15];
  49.         input.getline(place, 15, ':');
  50.         cout << setw(15) << place;
  51.  
  52.         char money[15];
  53.         input.getline(money,15);
  54.         cout << right  << setw(15) << "$ " << money << right << endl;
  55.         starline();
  56.  
  57.         ifstream fin;
  58.         double money = 0.0;
  59.         fin.open(FileName);
  60.  
  61.         double m = atof ( money);
  62.         //test for success, of course
  63.         fin >> money; //input stored in the double
  64.  
  65.     }
  66.  
  67.  
  68.  
  69.  
  70.     return 0;
  71. }
  72.  
Dec 9 '12 #1
1 2298
weaknessforcats
9,208 Expert Mod 8TB
You have two variables with the same name: money.
Dec 9 '12 #2

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

Similar topics

0
by: Tetedeiench | last post by:
Hi ! I am currently changing the server for my website, and i make a heavy use of openssl functions. Both servers use PHP4.3.3 with OpenSSL 0.9.6i. I was actually testing with this code,...
0
by: Farooq Khan | last post by:
hi, my development team has been assigned a project that involves writing our own Web service. i happen to be a C++ programmer, new to C#/ASP.net. i dont know where to begin with......any...
1
by: David | last post by:
Lately I have been getting the following error with all of my web applications, in debug and release mode. "Error while trying to run project: Unable to start debugging on the web server. Could...
4
momotaro
by: momotaro | last post by:
the problem is in the function "Swap" This is the error message that i get: Error 3 error C2088: '*' : illegal for struct and this is my prog: #include <stdio.h> typedef struct {
2
by: rasmidas | last post by:
Hi, I am getting the following error while I am running my application. EXITING AddToEventLog() EXITING WriteNoDocProdEvent() EXITING SubstituteSummitMessages() EXITING dmgDocumentCreate ()...
10
by: Rahul Babbar | last post by:
Hi, I am getting the following error, while executing the simple insert script on a few tables. INSERT INTO <table_name>(<col1>) VALUES (1); DB2 SQL error: SQLCODE: -440, SQLSTATE: 42884,...
3
by: sachinv1821 | last post by:
hi , i am Getting this Error fatal error C1189: #error : "eh.h is only for C++!" my Problem is i am Having C++ librabry and Appropriate .h file i want to Access Them is .c File Files..... to Be...
10
by: sachinv1821 | last post by:
hi , i am Getting this Error fatal error C1189: #error : "eh.h is only for C++!" my Problem is i am Having C++ librabry and Appropriate .h file i want to Access Them is .c File Files..... to Be...
7
by: ashraf02 | last post by:
i have check the code thoroughly to find the error i am still getting the following error: Parse error: syntax error, unexpected T_VARIABLE in C:\wamp\www\Catalogue.php on line 23 <!DOCTYPE html...
10
by: charmeda103 | last post by:
My program keeps getting me and error and i dont why here is the error message error C2061: syntax error: identifier 'infile' error C2660: 'ReadDate' : function does not take 6 arguments...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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?
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...

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.