type name not allowed error

I am trying to write a program that reads a text file and returns the most frequent and least frequent letter. but for some reason i am getting a type name not allowed error on my Letter_Stats for some reason. Any help would be appreciated.

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
  #include "stdafx.h"
#include <fstream>
#include <iostream>
#include <vector>
#include <string>
#include <cctype>

using namespace std;
using std::count;
using std::cin;
using std::endl;
using std::vector;

struct Letter_Stats

{
	int count;
	char ch;
};

void display(Letter_Stats, Letter_Stats);

int main()
{
	ifstream inFile;
	char ch;
	int i;
	Letter_Stats stats[26];
	Letter_Stats small, large;

	inFile.open("C:/Users/EJ/Documents/letter_count.txt");
	if (!inFile)
	{
		cout << "The input file could not be opened." << endl;
		return 1;
	}

	for (i = 0; i<26; i++)
	{
		stats[i].count = 0;
		stats[i].ch = ('A' + i);
	}

	while (!inFile.eof())
	{
		inFile.get(ch);
		
		if ('A' <= toupper(ch) && toupper(ch) <= 'Z')
			stats[toupper(ch) - 'A'].count++;
	}

	inFile.close();
	
	small = stats[0];
	large = stats[0];

	for (i = 1; i<26; i++)

	{
		if (stats[i].count > large.count)
		{
			large = Letter_Stats[i];
		}
		if (stats[i].count < small.count)
		{
			small = Letter_Stats[i];
		}
	}
	display(large, small);
		return 0;
}

void display(Letter_Stats lar, Letter_Stats sma)
{
	cout << "The most common Letter is" << lar.ch << "with" << lar.count << "occurances";
	cout << "The least common Letter is" << sma.ch << "with" << sma.count << "occurances";
}
Line 62/66 Letter_Stats is the name of the struct. You want the name of the data/array which is stats
thank you so much that worked.
Topic archived. No new replies allowed.