Welcome to Dream.In.Code
Getting C++ Help is Easy!

Join 136,094 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 1,608 people online right now. Registration is fast and FREE... Join Now!




distinguishing characters to do calculations

3 Pages V  1 2 3 >  
Closed TopicStart new topic

distinguishing characters to do calculations

zandiago
12 Oct, 2007 - 09:38 AM
Post #1

D.I.C Head
**

Joined: 13 Jul, 2007
Posts: 190


My Contributions
CODE

#include <iomanip>
#include <cmath>
#include <fstream>
#include <string>
#include<string>
#include<iostream>

using namespace std;


int main()
{
    
    string employee;

    ifstream infile;
    ofstream outfile;

    infile.open ("paydata3.txt");
    outfile.open ("PayOutput");

    double hours, rate, otime, dependents, empnum;
    string last,first,emptype,utype;//name of employee, city or suburb employee, union or non-union employee

    while (infile>>last>>first>>emptype>>utype>>empnum>>hours>>rate>>dependents>>otime)
    {
            
            string first = "";
            string last = "";
            last = employee.substr(0,14);
                            
    }
    cout<<"Emp. #   First Name         Last Name      Hours     Rate     Overtime     Gross    Fed Tax    FICA    City Tax     Union Dues    Net Pay"<<endl;
    double hours = (hours * rate) + (1.5 * otime);//calculate net pay if employee works overtime

    if (emptype == 'C')
    {
    double city = (gross * 0.04);//cost for working in the city
    }
    else city = 0.0;
    if (utype == 'M')
    {
    double uni = (gross * 0.0473);//cost for being apart of the union
    }
    else uni = 0.0;
    double net = ( gross - deductions);//net pay
    double fica = (gross * 0.0765);
    double ftax = ((gross - 17 * dependents) * 0.1834);//federal tax

    cout<<"Number of employees processed = "<<endl;
    cout<<"Total Gross Pay = "<<endl;
    cout<<"Total Federal Tax= "<<endl;
    cout<<"Total FICA= "<<endl;
    cout<<"Total Hours Worked= "<<endl;
    cout<<"Total Overtime Hours Worked= "<<endl;



    return 0;
}

My infile:
CODE

Schanz         Hannelore SX1234540.009.551000.0
Liffer         Umfritz   CM2345638.508.670301.5
Ajahb          Fyndmee   CX3456739.606.830203.9
Zyzz           Abba      CX4567840.310.910200.5
Goodgrayed     Ineeda    SM5678938.713.520202.0
Bath           Uneeda    CM6789039.311.110102.5
Strongbreeze   Ifelta    CM7890139.607.930300.0
Anapple        Iyate     SX8901239.905.950000.0
Kulate         Cal       SX9012340.007.870104.0
Isemtee        Mytank    CM0123440.514.880712.5
Lihd           Flippa    CM1123440.112.220410.3
Lyfe           Getta     CM2234540.206.750309.4
Franzipanni    Gwoppo    SM3345637.805.920205.3
Sanchez        Fillipina CX4456738.311.220106.1
Regulurr       Ear       SX5567839.410.050300.0
Enstance       Hap       SM6678940.409.250204.4
Lawreeyat      Backa     CM7789040.009.310202.2
Doothis        Ugonna    CM8890139.013.250203.3
Rupowch        Kanga     CM9901238.615.960612.8
Lewser         Sheesa    SX1112344.312.940308.1
Bustid         Mikars    SM2223440.308.880502.3
Mylegg         Letgo     CM3334548.913.380811.1
Stee           Iyamthur  CX4445644.408.880101.7

My assignment is as follows:
Write a c++ program that will read in an unknown number of employee records from a text file call “PAYDATA3.TXT”. Each employees record is a string of 47 characters (with spaces), set up as follows:

Positions Data Description
0 – 14 Last Name (15 characters)
15 -24 First name (10 characters)
25 Contains C if employee works in City office, otherwise S for Suburb
26 Contains M if employee is a union member, X if not a union member
27 – 31 Employee Number (5 digit characters)
32 – 35 Hours Worked (4 characters, in tenths)
36 – 40 Hourly Rate of Pay (5 characters)
41-42 Number of Dependents (2 characters)
43 – 46 Overtime hours worked (4 characters, in tenths, if any)

The program must perform the following tasks:
A. For each employee, calculate the gross pay
Gross = hours worked times hourly rate plus overtime hours time hourly rate times 1 ½
B. For each employee calculate the net pay as follows:
a. net pay = gross minus deductions
b. deductions are calculated as follows:
Federal Tax = (gross minus 17 times no. of dependents) times 18.34%
FICA = gross times 7.65%
City Tax = $0.00 if employee works in the suburbs
4% of gross if employee works in the City
Union Dues = $0.00 if employee is not a union member
4.73% of gross if employee is a union member

For each employee, print 1 line of information as follows: (In WORDPAD, File>
Page Setup>Landcape) [Screen will show 2 lines for each employee – This is OK]
Emp. # First Name Last Name Hours Rate Overtime Gross Fed Tax FICA City Tax Union Dues Net Pay
(All with 2 decimals)

Also compute and print (decimal points must line up vertically)
1. Number of employees processed = XX
2. Total Gross Pay = XXXX.XX
3. Total Federal Tax = XXXX.XX
4. Total FICA = XXXX.XX
5. Total Hours Worked = XXX.XX
6. Total Overtime Hours Worked = XXX.XX

Below, # is a space

Example: Jefferson######Alford####CM2111239.811.340406.6

21112 Alford Jefferson 39.80 11.34 6.60 563.60 90.89 43.12 22.54 26.66 380.39

Any assistance is appreciated.
User is offlineProfile CardPM
+Quote Post

Martyr2
RE: Distinguishing Characters To Do Calculations
12 Oct, 2007 - 09:42 AM
Post #2

Programming Theoretician
Group Icon

Joined: 18 Apr, 2007
Posts: 5,198



Thanked: 213 times
Expert In: C/C++, Java, VB, VB.NET, C#, PHP, Web Development, HTML & CSS, Javascript

My Contributions
Perhaps you can tell us what you are having a problem with. smile.gif
User is online!Profile CardPM
+Quote Post

zandiago
RE: Distinguishing Characters To Do Calculations
12 Oct, 2007 - 09:57 AM
Post #3

D.I.C Head
**

Joined: 13 Jul, 2007
Posts: 190


My Contributions
Oopsss. As you can see from my infile, it has several characters for each employee:
Positions Data Description
0 – 14 Last Name (15 characters)
15 -24 First name (10 characters)
25 Contains C if employee works in City office, otherwise S for Suburb
26 Contains M if employee is a union member, X if not a union member
27 – 31 Employee Number (5 digit characters)
32 – 35 Hours Worked (4 characters, in tenths)
36 – 40 Hourly Rate of Pay (5 characters)
41-42 Number of Dependents (2 characters)
43 – 46 Overtime hours worked (4 characters, in tenths, if any)
So, how can i let it distinguish between the meanings of the different terms? Would i have to use the isalpha function? How could i access the different parts of that string to carry out the calcualtions? Thanks.


This post has been edited by zandiago: 12 Oct, 2007 - 10:12 AM
User is offlineProfile CardPM
+Quote Post

Martyr2
RE: Distinguishing Characters To Do Calculations
12 Oct, 2007 - 10:11 AM
Post #4

Programming Theoretician
Group Icon

Joined: 18 Apr, 2007
Posts: 5,198



Thanked: 213 times
Expert In: C/C++, Java, VB, VB.NET, C#, PHP, Web Development, HTML & CSS, Javascript

My Contributions
Have you considered creating an employee object? You would read the line from the text file and pass it to this employee object which would break it into the various parts (just by looping through the characters) and store it in its own member variables. Then to do all your calculations would be as simple as....

CODE

cout << "Total pay: " << (employee->getPayRate() * employee->getHours()) + (employee->overtime() * (employee->getPayRate() * 1.1)) << endl;

// Or better yet, wrap that work up into a "getGrossPay()" function so you could do...
cout << "Total gross: " << employee->getGrossPay() << endl;


I am quite sure your instructor is going to be looking for an implementation of the employee class. Notice how they mention employee like a bajillion times.

So start by formulating an employee class and we can work on that.

smile.gif
User is online!Profile CardPM
+Quote Post

zandiago
RE: Distinguishing Characters To Do Calculations
12 Oct, 2007 - 10:13 AM
Post #5

D.I.C Head
**

Joined: 13 Jul, 2007
Posts: 190


My Contributions
sorry for the multi-post, the website froze.
User is offlineProfile CardPM
+Quote Post

zandiago
RE: Distinguishing Characters To Do Calculations
13 Oct, 2007 - 08:27 AM
Post #6

D.I.C Head
**

Joined: 13 Jul, 2007
Posts: 190


My Contributions
CODE

#include <iomanip>
#include <cmath>
#include <fstream>
#include<string>
#include<iostream>

using namespace std;

int main ()

{
ifstream infile;
ofstream outfile;

infile.open ("paydata3.txt");
outfile.open ("payOutput");

double info, name, hours, rate, depend, otime;
stringstream sshours, ssrate, ssdepend, ssotime;
double gross, hour, rat, depen, otim, fedtax, fica, ctax, udues, net, overtime,netpay,deductions, citytax, uniondues;
int count = 0;
while (! infile)
{
cout << "Error opening file " << endl;
exit(1);
}

while (getline (infile, info))
{

string name = info;
string last, first, city, uni, empnum, depend, hours, rate, otime;

last = name.substr(0,14);
first = name.substr(15,10);
city = name.substr(25,1);
cin >> city;
uni = name.substr(26,1);
empnum = name.substr(27,5);
hours = name.substr(32,4);
rate = name.substr(36,5);
depend = name.substr(41,2);
otime = name.substr(43,4);

if ( count++ < 21 )
{
hours = name.substr(32,4);
sshours << hours;
sshours >> hour;
sshours.clear();
rate = name.substr(36,5);
ssrate << rate;
ssrate >> rat;
ssrate.clear();
depend = name.substr(41,2);
ssrate << depend;
ssrate >> depen;
ssrate.clear();
otime = name.substr(43,4);
ssrate << otime;
ssrate >> otim;
ssrate.clear();

gross = ((hour * rat));
cout << fixed << showpoint << setprecision(2);
cout << gross << endl;

fedtax = ((gross - (depen*17.0))*.1834);
fica = (gross * .0765);

if (city == "S")
{
ctax = 0.00;
}
else if (city == "C")
{
ctax = (gross * 0.04);
}
ssrate << ctax;
ssrate >> citytax;

if (uni == "X")
{
udues = 0.00;
}
else if (city == "M")
{
udues = (gross * .0473);
}
ssrate << udues;
ssrate >> uniondues;

deductions = (fedtax + fica + citytax + uniondues);

netpay = (gross - deductions);

cout << deductions << endl;
}
    infile.close();
    outfile.close();
}
    return 0;
}


I get the following error messages:

CODE

'sshours', 'ssrate', 'ssdepend', 'ssotime',  uses undefined class

Also said something is wrong with my use of 'getline'. Thx for all the assistance.
User is offlineProfile CardPM
+Quote Post

zandiago
RE: Distinguishing Characters To Do Calculations
13 Oct, 2007 - 12:50 PM
Post #7

D.I.C Head
**

Joined: 13 Jul, 2007
Posts: 190


My Contributions
any idea why i get the following error message when i try to load the Dream In Code website:
Openads has not been installed yet -- please read the INSTALL.txt file
User is offlineProfile CardPM
+Quote Post

Amadeus
RE: Distinguishing Characters To Do Calculations
13 Oct, 2007 - 01:03 PM
Post #8

g++ -o drink whiskey.cpp
Group Icon

Joined: 12 Jul, 2002
Posts: 12,226



Thanked: 37 times
Dream Kudos: 25
My Contributions
For your stringstream variables, you need to include the <sstream> header.

As for the getline error, we'd need to see the exact error.
User is online!Profile CardPM
+Quote Post

zandiago
RE: Distinguishing Characters To Do Calculations
13 Oct, 2007 - 01:07 PM
Post #9

D.I.C Head
**

Joined: 13 Jul, 2007
Posts: 190


My Contributions
Didn't pick up that one...thx again, let me post the other errors that i get.
User is offlineProfile CardPM
+Quote Post

zandiago
RE: Distinguishing Characters To Do Calculations
13 Oct, 2007 - 01:19 PM
Post #10

D.I.C Head
**

Joined: 13 Jul, 2007
Posts: 190


My Contributions
CODE

1>Compiling...
1>payroll.cpp
1>c:\users\documents\visual studio 2008\projects\payroll\payroll\payroll.cpp(53) : error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,const std::basic_string<_Elem,_Traits,_Alloc> &)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'double'
1>        c:\program files\microsoft visual studio 9.0\vc\include\string(537) : see declaration of 'std::operator <<'
1>c:\users\documents\visual studio 2008\projects\payroll\payroll\payroll.cpp(53) : error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,const std::_Smanip<_Arg> &)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'double'
1>        c:\program files\microsoft visual studio 9.0\vc\include\iomanip(79) : see declaration of 'std::operator <<'
1>c:\users\documents\visual studio 2008\projects\payroll\payroll\payroll.cpp(53) : error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,const std::_Fillobj<_Elem> &)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'double'
1>        c:\program files\microsoft visual studio 9.0\vc\include\iomanip(46) : see declaration of 'std::operator <<'
1>c:\users\documents\visual studio 2008\projects\payroll\payroll\payroll.cpp(53) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,unsigned char)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'double'
1>        c:\program files\microsoft visual studio 9.0\vc\include\ostream(930) : see declaration of 'std::operator <<'
1>c:\users\neil\documents\visual studio 2008\projects\payroll\payroll\payroll.cpp(53) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,const unsigned char *)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'double'
1>        c:\program files\microsoft visual studio 9.0\vc\include\ostream(923) : see declaration of 'std::operator <<'
1>c:\users\documents\visual studio 2008\projects\payroll\payroll\payroll.cpp(53) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,signed char)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'double'
1>        c:\program files\microsoft visual studio 9.0\vc\include\ostream(916) : see declaration of 'std::operator <<'
1>c:\users\documents\visual studio 2008\projects\payroll\payroll\payroll.cpp(53) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,const signed char *)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'double'
1>        c:\program files\microsoft visual studio 9.0\vc\include\ostream(909) : see declaration of 'std::operator <<'
1>c:\users\documents\visual studio 2008\projects\payroll\payroll\payroll.cpp(53) : error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,_Elem)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'double'
1>        c:\program files\microsoft visual studio 9.0\vc\include\ostream(871) : see declaration of 'std::operator <<'
1>c:\users\neil\documents\visual studio 2008\projects\payroll\payroll\payroll.cpp(53) : error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,const _Elem *)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'double'
1>        c:\program files\microsoft visual studio 9.0\vc\include\ostream(825) : see declaration of 'std::operator <<'
1>c:\users\documents\visual studio 2008\projects\payroll\payroll\payroll.cpp(53) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,char)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'double'
1>        c:\program files\microsoft visual studio 9.0\vc\include\ostream(785) : see declaration of 'std::operator <<'
1>c:\users\documents\visual studio 2008\projects\payroll\payroll\payroll.cpp(53) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,const char *)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'double'
1>        c:\program files\microsoft visual studio 9.0\vc\include\ostream(738) : see declaration of 'std::operator <<'
1>c:\users\documents\visual studio 2008\projects\payroll\payroll\payroll.cpp(53) : error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,char)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'double'
1>        c:\program files\microsoft visual studio 9.0\vc\include\ostream(700) : see declaration of 'std::operator <<'
1>c:\users\documents\visual studio 2008\projects\payroll\payroll\payroll.cpp(53) : error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,const char *)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'double'
1>        c:\program files\microsoft visual studio 9.0\vc\include\ostream(653) : see declaration of 'std::operator <<'
1>c:\users\documents\visual studio 2008\projects\payroll\payroll\payroll.cpp(53) : error C2677: binary '<<' : no global operator found which takes type 'std::string' (or there is no acceptable conversion)
1>c:\users\documents\visual studio 2008\projects\payroll\payroll\payroll.cpp(54) : error C2296: '>>' : illegal, left operand has type 'double'
1>c:\users\documents\visual studio 2008\projects\payroll\payroll\payroll.cpp(54) : error C2297: '>>' : illegal, right operand has type 'double'
1>c:\users\documents\visual studio 2008\projects\payroll\payroll\payroll.cpp(55) : error C2228: left of '.clear' must have class/struct/union
1>        type is 'double'
1>c:\users\documents\visual studio 2008\projects\payroll\payroll\payroll.cpp(57) : error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,const std::basic_string<_Elem,_Traits,_Alloc> &)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'double'
1>        c:\program files\microsoft visual studio 9.0\vc\include\string(537) : see declaration of 'std::operator <<'
1>c:\users\documents\visual studio 2008\projects\payroll\payroll\payroll.cpp(57) : error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,const std::_Smanip<_Arg> &)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'double'
1>        c:\program files\microsoft visual studio 9.0\vc\include\iomanip(79) : see declaration of 'std::operator <<'
1>c:\users\documents\visual studio 2008\projects\payroll\payroll\payroll.cpp(57) : error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,const std::_Fillobj<_Elem> &)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'double'
1>        c:\program files\microsoft visual studio 9.0\vc\include\iomanip(46) : see declaration of 'std::operator <<'
1>c:\users\documents\visual studio 2008\projects\payroll\payroll\payroll.cpp(57) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,unsigned char)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'double'
1>        c:\program files\microsoft visual studio 9.0\vc\include\ostream(930) : see declaration of 'std::operator <<'
1>c:\users\documents\visual studio 2008\projects\payroll\payroll\payroll.cpp(57) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,const unsigned char *)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'double'
1>        c:\program files\microsoft visual studio 9.0\vc\include\ostream(923) : see declaration of 'std::operator <<'
1>c:\users\documents\visual studio 2008\projects\payroll\payroll\payroll.cpp(57) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,signed char)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'double'
1>        c:\program files\microsoft visual studio 9.0\vc\include\ostream(916) : see declaration of 'std::operator <<'
1>c:\users\documents\visual studio 2008\projects\payroll\payroll\payroll.cpp(57) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,const signed char *)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'double'
1>        c:\program files\microsoft visual studio 9.0\vc\include\ostream(909) : see declaration of 'std::operator <<'
1>c:\users\documents\visual studio 2008\projects\payroll\payroll\payroll.cpp(57) : error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,_Elem)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'double'
1>        c:\program files\microsoft visual studio 9.0\vc\include\ostream(871) : see declaration of 'std::operator <<'
1>c:\users\documents\visual studio 2008\projects\payroll\payroll\payroll.cpp(57) : error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,const _Elem *)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'double'
1>        c:\program files\microsoft visual studio 9.0\vc\include\ostream(825) : see declaration of 'std::operator <<'
1>c:\users\documents\visual studio 2008\projects\payroll\payroll\payroll.cpp(57) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,char)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'double'
1>        c:\program files\microsoft visual studio 9.0\vc\include\ostream(785) : see declaration of 'std::operator <<'
1>c:\users\documents\visual studio 2008\projects\payroll\payroll\payroll.cpp(57) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,const char *)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'double'
1>        c:\program files\microsoft visual studio 9.0\vc\include\ostream(738) : see declaration of 'std::operator <<'
1>c:\users\documents\visual studio 2008\projects\payroll\payroll\payroll.cpp(57) : error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,char)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'double'
1>        c:\program files\microsoft visual studio 9.0\vc\include\ostream(700) : see declaration of 'std::operator <<'
1>c:\users\documents\visual studio 2008\projects\payroll\payroll\payroll.cpp(57) : error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,const char *)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'double'
1>        c:\program files\microsoft visual studio 9.0\vc\include\ostream(653) : see declaration of 'std::operator <<'
1>c:\users\documents\visual studio 2008\projects\payroll\payroll\payroll.cpp(57) : error C2677: binary '<<' : no global operator found which takes type 'std::string' (or there is no acceptable conversion)
1>c:\users\documents\visual studio 2008\projects\payroll\payroll\payroll.cpp(58) : error C2296: '>>' : illegal, left operand has type 'double'
1>c:\users\documents\visual studio 2008\projects\payroll\payroll\payroll.cpp(58) : error C2297: '>>' : illegal, right operand has type 'double'
1>c:\users\documents\visual studio 2008\projects\payroll\payroll\payroll.cpp(59) : error C2228: left of '.clear' must have class/struct/union
1>        type is 'double'
1>c:\users\documents\visual studio 2008\projects\payroll\payroll\payroll.cpp(61) : error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,const std::basic_string<_Elem,_Traits,_Alloc> &)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'double'
1>        c:\program files\microsoft visual studio 9.0\vc\include\string(537) : see declaration of 'std::operator <<'
1>c:\users\documents\visual studio 2008\projects\payroll\payroll\payroll.cpp(61) : error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,const std::_Smanip<_Arg> &)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'double'
1>        c:\program files\microsoft visual studio 9.0\vc\include\iomanip(79) : see declaration of 'std::operator <<'
1>c:\users\documents\visual studio 2008\projects\payroll\payroll\payroll.cpp(61) : error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,const std::_Fillobj<_Elem> &)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'double'
1>        c:\program files\microsoft visual studio 9.0\vc\include\iomanip(46) : see declaration of 'std::operator <<'
1>c:\users\documents\visual studio 2008\projects\payroll\payroll\payroll.cpp(61) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,unsigned char)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'double'
1>        c:\program files\microsoft visual studio 9.0\vc\include\ostream(930) : see declaration of 'std::operator <<'
1>c:\users\documents\visual studio 2008\projects\payroll\payroll\payroll.cpp(61) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,const unsigned char *)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'double'
1>        c:\program files\microsoft visual studio 9.0\vc\include\ostream(923) : see declaration of 'std::operator <<'
1>c:\users\documents\visual studio 2008\projects\payroll\payroll\payroll.cpp(61) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,signed char)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'double'
1>        c:\program files\microsoft visual studio 9.0\vc\include\ostream(916) : see declaration of 'std::operator <<'
1>c:\users\documents\visual studio 2008\projects\payroll\payroll\payroll.cpp(61) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,const signed char *)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'double'
1>        c:\program files\microsoft visual studio 9.0\vc\include\ostream(909) : see declaration of 'std::operator <<'
1>c:\users\documents\visual studio 2008\projects\payroll\payroll\payroll.cpp(61) : error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,_Elem)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'double'
1>        c:\program files\microsoft visual studio 9.0\vc\include\ostream(871) : see declaration of 'std::operator <<'
1>c:\users\documents\visual studio 2008\projects\payroll\payroll\payroll.cpp(61) : error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,const _Elem *)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'double'
1>        c:\program files\microsoft visual studio 9.0\vc\include\ostream(825) : see declaration of 'std::operator <<'
1>c:\users\documents\visual studio 2008\projects\payroll\payroll\payroll.cpp(61) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,char)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'double'
1>        c:\program files\microsoft visual studio 9.0\vc\include\ostream(785) : see declaration of 'std::operator <<'
1>c:\users\documents\visual studio 2008\projects\payroll\payroll\payroll.cpp(61) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,const char *)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'double'
1>        c:\program files\microsoft visual studio 9.0\vc\include\ostream(738) : see declaration of 'std::operator <<'
1>c:\users\documents\visual studio 2008\projects\payroll\payroll\payroll.cpp(61) : error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,char)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'double'
1>        c:\program files\microsoft visual studio 9.0\vc\include\ostream(700) : see declaration of 'std::operator <<'
1>c:\users\documents\visual studio 2008\projects\payroll\payroll\payroll.cpp(61) : error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,const char *)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'double'
1>        c:\program files\microsoft visual studio 9.0\vc\include\ostream(653) : see declaration of 'std::operator <<'
1>c:\users\documents\visual studio 2008\projects\payroll\payroll\payroll.cpp(61) : error C2677: binary '<<' : no global operator found which takes type 'std::string' (or there is no acceptable conversion)
1>c:\users\documents\visual studio 2008\projects\payroll\payroll\payroll.cpp(62) : error C2296: '>>' : illegal, left operand has type 'double'
1>c:\users\documents\visual studio 2008\projects\payroll\payroll\payroll.cpp(62) : error C2297: '>>' : illegal, right operand has type 'double'
1>c:\users\documents\visual studio 2008\projects\payroll\payroll\payroll.cpp(63) : error C2228: left of '.clear' must have class/struct/union
1>        type is 'double'
1>c:\users\documents\visual studio 2008\projects\payroll\payroll\payroll.cpp(65) : error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,const std::basic_string<_Elem,_Traits,_Alloc> &)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'double'
1>        c:\program files\microsoft visual studio 9.0\vc\include\string(537) : see declaration of 'std::operator <<'
1>c:\users\documents\visual studio 2008\projects\payroll\payroll\payroll.cpp(65) : error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,const std::_Smanip<_Arg> &)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'double'
1>        c:\program files\microsoft visual studio 9.0\vc\include\iomanip(79) : see declaration of 'std::operator <<'
1>c:\users\documents\visual studio 2008\projects\payroll\payroll\payroll.cpp(65) : error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,const std::_Fillobj<_Elem> &)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'double'
1>        c:\program files\microsoft visual studio 9.0\vc\include\iomanip(46) : see declaration of 'std::operator <<'
1>c:\users\documents\visual studio 2008\projects\payroll\payroll\payroll.cpp(65) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,unsigned char)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'double'
1>        c:\program files\microsoft visual studio 9.0\vc\include\ostream(930) : see declaration of 'std::operator <<'
1>c:\users\documents\visual studio 2008\projects\payroll\payroll\payroll.cpp(65) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,const unsigned char *)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'double'
1>        c:\program files\microsoft visual studio 9.0\vc\include\ostream(923) : see declaration of 'std::operator <<'
1>c:\users\documents\visual studio 2008\projects\payroll\payroll\payroll.cpp(65) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,signed char)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'double'
1>        c:\program files\microsoft visual studio 9.0\vc\include\ostream(916) : see declaration of 'std::operator <<'
1>c:\users\documents\visual studio 2008\projects\payroll\payroll\payroll.cpp(65) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,const signed char *)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'double'
1>        c:\program files\microsoft visual studio 9.0\vc\include\ostream(909) : see declaration of 'std::operator <<'
1>c:\users\documents\visual studio 2008\projects\payroll\payroll\payroll.cpp(65) : error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,_Elem)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'double'
1>        c:\program files\microsoft visual studio 9.0\vc\include\ostream(871) : see declaration of 'std::operator <<'
1>c:\users\documents\visual studio 2008\projects\payroll\payroll\payroll.cpp(65) : error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,const _Elem *)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'double'
1>        c:\program files\microsoft visual studio 9.0\vc\include\ostream(825) : see declaration of 'std::operator <<'
1>c:\users\documents\visual studio 2008\projects\payroll\payroll\payroll.cpp(65) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,char)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'double'
1>        c:\program files\microsoft visual studio 9.0\vc\include\ostream(785) : see declaration of 'std::operator <<'
1>c:\users\documents\visual studio 2008\projects\payroll\payroll\payroll.cpp(65) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,const char *)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'double'
1>        c:\program files\microsoft visual studio 9.0\vc\include\ostream(738) : see declaration of 'std::operator <<'
1>c:\users\documents\visual studio 2008\projects\payroll\payroll\payroll.cpp(65) : error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,char)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'double'
1>        c:\program files\microsoft visual studio 9.0\vc\include\ostream(700) : see declaration of 'std::operator <<'
1>c:\users\documents\visual studio 2008\projects\payroll\payroll\payroll.cpp(65) : error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,const char *)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'double'
1>        c:\program files\microsoft visual studio 9.0\vc\include\ostream(653) : see declaration of 'std::operator <<'
1>c:\users\documents\visual studio 2008\projects\payroll\payroll\payroll.cpp(65) : error C2677: binary '<<' : no global operator found which takes type 'std::string' (or there is no acceptable conversion)
1>c:\users\documents\visual studio 2008\projects\payroll\payroll\payroll.cpp(66) : error C2296: '>>' : illegal, left operand has type 'double'
1>c:\users\documents\visual studio 2008\projects\payroll\payroll\payroll.cpp(66) : error C2297: '>>' : illegal, right operand has type 'double'
1>c:\users\documents\visual studio 2008\projects\payroll\payroll\payroll.cpp(67) : error C2228: left of '.clear' must have class/struct/union
1>        type is 'double'
1>c:\users\documents\visual studio 2008\projects\payroll\payroll\payroll.cpp(84) : error C2296: '<<' : illegal, left operand has type 'double'
1>c:\users\documents\visual studio 2008\projects\payroll\payroll\payroll.cpp(84) : error C2297: '<<' : illegal, right operand has type 'double'
1>c:\users\documents\visual studio 2008\projects\payroll\payroll\payroll.cpp(85) : error C2296: '>>' : illegal, left operand has type 'double'
1>c:\users\documents\visual studio 2008\projects\payroll\payroll\payroll.cpp(85) : error C2297: '>>' : illegal, right operand has type 'double'
1>c:\users\documents\visual studio 2008\projects\payroll\payroll\payroll.cpp(95) : error C2296: '<<' : illegal, left operand has type 'double'
1>c:\users\documents\visual studio 2008\projects\payroll\payroll\payroll.cpp(95) : error C2297: '<<' : illegal, right operand has type 'double'
1>c:\users\neil\documents\visual studio 2008\projects\payroll\payroll\payroll.cpp(96) : error C2296: '>>' : illegal, left operand has type 'double'
1>c:\users\documents\visual studio 2008\projects\payroll\payroll\payroll.cpp(96) : error C2297: '>>' : illegal, right operand has type 'double'
1>Build log was saved at "file://c:\Users\Documents\Visual Studio 2008\Projects\payroll\payroll\Debug\BuildLog.htm"
1>payroll - 76 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

I know it's crazy, a bit of syntax and i did check my '{}'s
User is offlineProfile CardPM
+Quote Post

Amadeus
RE: Distinguishing Characters To Do Calculations
13 Oct, 2007 - 01:30 PM
Post #11

g++ -o drink whiskey.cpp
Group Icon

Joined: 12 Jul, 2002
Posts: 12,226



Thanked: 37 times
Dream Kudos: 25
My Contributions
There appear to actually only be a couple of errors, one of which is usually seen when comparing incompatible data types, and the other when using data types with specific data containers.

Can you repost your exact current code, so we can be sure what we're working with?
User is online!