I keep getting this error when I am compiling my program. I am trying to read in this array and then convert all the characters to upper-case, but it is ging me this:
Code:
error C2664: 'toupper' : cannot convert parameter 1 from 'char [30]' to 'int'
This conversion requires a reinterpret_cast, a C-style cast or function-style cast
Error executing cl.exe.
Code:
#include <iostream.h>
#include <fstream.h>
#include <iomanip.h>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
//Global variables
ifstream infile;
ofstream outfile;
typedef char str[30];
//function prototypes
void tocaps(str []);
int main()
{
int n[30],m[30];
str name[30];
infile.open("in599A.dat");
while(!infile.eof())
{
for(int i=0;i<23;i++)
{
infile >> n[i];
infile >> m[i];
infile.getline(name[i],30);
cout << n[i] << endl << m[i] << endl
<< name[i] << endl;
}
//change to caps
tocaps(name);
//take off the last characters of middle name
//compare to second file
//add dashes to social security number and add dashes to phone number
//sort
//binary search
}
return 0;
}
void tocaps(str name[])
{
for(int i=0;i<23;i++)
{
name[i]=toupper(name[i]);
}
for(i=0;i<23;i++)
cout << name[i] << endl;
}