I have this program to write that Generate 100 lowercase letters randomly and assign to an array of characters (Chars[ ] ).
Count the occurrence of each letter in the array and save them in counts[ ].
Write a main function to test the different count. What i don't know get is what to write in char * createArray()?
A skeleton of the code is given below.
#include <iostream>
#include "RandomCharacter.h"
using namespace std;
const int NUMBER_OF_LETTERS = 100;
char * createArray();
void displayArray(char []);
int * countLetters(char []);
void displayCounts(int []);
int main()
{
// Declare and create an array
char * chars = createArray();
// Display the array
cout << "The lowercase letters are: " << endl;
displayArray(chars);
// Count the occurrences of each letter
int * counts = countLetters(chars);
// Display counts
cout << endl;
cout << "The occurrences of each letter are: " << endl;
displayCounts(counts);
return 0;
}
// Create an array of characters
char * createArray()
{
}
// Display the array of characters
void displayArray(char chars[])
{
}
// Count the occurrences of each letter
int * countLetters(char chars[])
{
}
// Display counts
void displayCounts(int counts[])
{
}