I've been trying to get this program to work, but when I debug I get this error
***\processor.cpp(35) : error C2446: '!=' : no conversion from 'const unsigned int' to 'const char *'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
.\processor.cpp(35) : error C2040: '!=' : 'const char [9]' differs in levels of indirection from 'const unsigned int'***
I am a beginner programming with C++, and only have basic knowledge. Here is my code
Code:
#include "header.h"
using namespace std;
//Variables
ifstream infile;
ofstream outfile;
char file[101];
string line;
int w = 0;
int l = 0;
int p = 0;
//Main Program
int main()
{
//Open files
cout << "Please enter the location of the";
cout << " history.";
cout << endl;
cin >> file;
infile.open(file);
while (!infile)
{
cout << "Cannot open the input file. Please re-enter.";
cout << endl;
cin >> file;
infile.open(file);
}
outfile.open("results.txt");
while (getline(infile, line))
{
if (line.find("Collects" != string::npos)
w++;
if (line.find("Loses" != string::npos)
l++;
if (line.find("Push" != string::npos)
p++;
}
outfile << "Wins = " << w << endl;
outfile << "Losses = " << l << endl;
outfile << "Pushes = " << p << endl;
infile.close();
outfile.close();
return 0;
}
I am using this input text file.
Stage # B506558848 - Blackjack 2009-02-13 14:51:22 (ET)
********** ( $30.00 in chips )
-----------------------------------------------------------------------
Hand 1-1: Bet $0.00 + Side Bet $0.00
Hand 2-1: Bet $5.00 + Side Bet $0.00
Hand 3-1: Bet $0.00 + Side Bet $0.00
-----------------------------------------------------------------------
Dealt to Hand 2-1: [ 5h 2s ]
Dealt to Dealer: [ 2s H ]
-----------------------------------------------------------------------
Hand 2-1: HIT
Dealt to Hand 2-1: [ 8s ]
Hand 2-1: STAND
-----------------------------------------------------------------------
Dealer: Hit
Dealt to Dealer: [ 3c ]
Dealer: Hit
Dealt to Dealer: [ 5s ]
Dealer: Hit
Dealt to Dealer: [ Ks ]
-----------------------------------------------------------------------
*** RESULT ***
Dealer [ 2s 3c 5s Ks ] (20)
Total Bet( $5.00 ), Win/Loss( -$5.00 )
Hand 2-1 [ 5h 2s 8s ] (15) - Loses $5.00
If someone could help me with what exactly the error is telling me to fix, I'd appreciate it.