i wrote a program and part of the instructions said "Write a program that prompts the user to enter text from the keyboard. The text is read until Ctrl+Z is entered, i.e., the end of file is reached." i dont completely understand wat this means then it gave an example.
The following input:
Th1s 1s a test.^Z
Should produce the following result:
1 2
a 1
e 1
h 1
s 3
t 3
Special symbols:4
if anyone can look at my program and tell me if i did it correctly i would appreciate it Thank You In Advance

.
CODE
#include<iostream>
#include<fstream>
#include<iomanip>
using namespace std;
#include<string>
#include<cctype>
string toUpper(string text)
{
string ret(text);
for(int i=0;i<text.length();i++)
{
ret[i]=toupper(text[i]);
}
return ret;
}
void printReport(int letters[], int numbers[], int special){
for (int i = 0; i < 10; i++)
{
if (numbers[i] > 0)
{
cout << i << " - " << numbers[i] << endl;
}
}
for (int i = 0; i < 26; i++)
{
if (letters[i] > 0)
{
cout << char(i + 65) << " - " << letters[i] << endl;
}
}
cout << "Special Symbols = " << special << endl;
}
void count(string input){
input = toUpper(input);
int letters[26] = {};
int numbers[10] = {};
int special = 0;
for (int i=0; i<input.length();i++)
{
char c = input[i];
int ascii = (int)c;
if ((ascii >= 65) && (ascii <= 90))
{
letters[ascii - 65]++;
}else if((ascii >= 48) && (ascii <= 57))
{
numbers[ascii - 48]++;
}else
{
special++;
}
}
printReport(letters, numbers, special);
}
int main()
{
string input;
cout << "Enter in the input text: ";
getline (cin, input);
count(input);
system("pause");
return 0;
}