File reading problem

I'm trying to get this program to read from a file, populate a string array and capitalize all data.
I keep getting errors that say "no matching function for call to
toupper( std:: string &)"
and
"no matching function for call to
isalpha( std:: string &)"
I imagine it's something to do with my string array. When I first began, I had it as a char array, but I got compiler errors for "getline"

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
 #include <iostream>
#include <fstream>
#include <string>
#include <iomanip>
#include <cstdlib>
#include <cstdio>
#include <conio.h>
#include <cctype> //for towlower() and toupper() functions
#include <cstring>
using namespace std;

bool check(string , int &);

int main()
{ 
	string pangram[110];
	fstream dataFile;
  	int index=0,count=0, count2, missing;
  	
	dataFile.open(".\\DATAFILES\\pangram.txt",ios::in);

	if(!dataFile.is_open())
    {
        cout<<"Unable to Process"<<endl;
        return 999;
    }
    while(!dataFile.eof())
    {
        getline(dataFile, pangram[index],'\n');
        index++;
    

  		for(index=0; index < 110;index++)
  		{
			pangram[index] = toupper(pangram[index]);

			if(isalpha(pangram[index]))
				count++;
		}

		cout << "\nThere are " << count<< " alphabetic characters in the string\n\n";

		if(check(pangram, count2))
	
			cout<<"The sentence is a pangram.\n\n";
	
		else
	
			cout<<"The sentence is not a pangram.\n\n";
	


	}


	return 0;
}
	
bool check(string pangram, int &check)
{

    check = 0;

    

    for (char letter = 'A'; letter <= 'Z'; letter++)
	{

        for (int index = 0; index < pangram.length(); index++)
		{
           	char temp = pangram[index];

          	if (temp == letter)	
			{
				check++;
                break;
            }
         }
    }

    if (check == 26)

        return true;

    else

        return false;

}
Last edited on
You're using the array inconsistently.
On line 29 you treat it as an array of strings, which is correct, but on lines 33-49 you treat it as a string in itself, which is not.
I'm not sure I understand. The for loop on line 33 is supposed to move subscripts of the array. What can I do differently?
Topic archived. No new replies allowed.