Smithy006
Apr 1st, 2001, 06:45 PM
Hi All,
I'm currently working on a really basic program but i Keep getting these stupid little problems. I'm having trouble with giving a char a value the compiler keeps giving me the error.
error C2440: '=' : cannot convert from 'char [19]' to 'char'
This conversion requires a reinterpret_cast, a C-style cast or function-style cast
Here's some sample source of what I'm trying to do...
#include <iostream.h>
//declare variables
char namea [30];
char nameb [30];
char namec [30];
char named [30];
char statusa;
char statusb;
char statusc;
char statusd;
char ainfoa; // These are the ones giving me the problem as showed below...
char ainfob;
char ainfoc;
char ainfod;
double payhour;
double timework;
double totala;
double totalb;
double totalc;
double totald;
int main()
{
cout << "$$$$$$$$$$ Welcome to the Pay Calculation Program Ver 2.0 $$$$$$$$$$\n" << endl;
cout << " Program By Ben Smith\n" << endl;
// first person
cout << "Enter the first persons name: ";
cin >> namea;
cout << "Enter the first persons amount per hour received: ";
cin >> payhour;
cout << "Enter the number of hours the person works: ";
cin >> timework;
cout << "Enter their pay status..." << endl;
cout << "[Enter S for Salaried, P for Permanant or T for Temporary]: ";
cin >> statusa;
// calculate and save in total a. Add additional Info
totala = payhour * timework;
if ((totala >= 25) && (statusa == 's' || statusa == 'S'))
ainfoa = "Standard- Salaried";
else
if (totala >= 25)
ainfoa = "Plusrate";
Any Help would be Greatly appreciated!!!!
Thanks.
I'm currently working on a really basic program but i Keep getting these stupid little problems. I'm having trouble with giving a char a value the compiler keeps giving me the error.
error C2440: '=' : cannot convert from 'char [19]' to 'char'
This conversion requires a reinterpret_cast, a C-style cast or function-style cast
Here's some sample source of what I'm trying to do...
#include <iostream.h>
//declare variables
char namea [30];
char nameb [30];
char namec [30];
char named [30];
char statusa;
char statusb;
char statusc;
char statusd;
char ainfoa; // These are the ones giving me the problem as showed below...
char ainfob;
char ainfoc;
char ainfod;
double payhour;
double timework;
double totala;
double totalb;
double totalc;
double totald;
int main()
{
cout << "$$$$$$$$$$ Welcome to the Pay Calculation Program Ver 2.0 $$$$$$$$$$\n" << endl;
cout << " Program By Ben Smith\n" << endl;
// first person
cout << "Enter the first persons name: ";
cin >> namea;
cout << "Enter the first persons amount per hour received: ";
cin >> payhour;
cout << "Enter the number of hours the person works: ";
cin >> timework;
cout << "Enter their pay status..." << endl;
cout << "[Enter S for Salaried, P for Permanant or T for Temporary]: ";
cin >> statusa;
// calculate and save in total a. Add additional Info
totala = payhour * timework;
if ((totala >= 25) && (statusa == 's' || statusa == 'S'))
ainfoa = "Standard- Salaried";
else
if (totala >= 25)
ainfoa = "Plusrate";
Any Help would be Greatly appreciated!!!!
Thanks.