Help plz

I am stuck with array and function at the same time :S


i am supposed to design a program that prompt the user for a word

"that is easy". i should count the number of times the letters entered appears in the word, "easy as well". this is when start giving problem

"and then continues prompting for a new letters. the program should list the letters found. it give me a hint to use a boolean array size 26 to track whether a letter has been found.


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
//declare Header Files
#include <iostream>
#include <string>
#include <cctype>
using namespace std;

//start main function
int main ()
{
       //declare variables
	string word, sentence;
	char ch, letter;
	int i,counter;

  

       
	cout << "\nPlease enter a word: ";
     
	cin >> word;

	cout<<"The word contains "<<word.length()<<" characters."<<endl;



i have no idea how to use the array with funtion
help plz
i got it
thanks for no help

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
91
92
93
94
95
/*****************************************************************************************************

******************************************************************************************************/
//declare Header Files
#include <iostream>
#include <string>
using namespace std;

//declare funtions 
void LetterArray (char letterlist[], char ch);
int numb_count[26] = {0};

string word;
//start main function
int main ()
{
	//declare variables

	char ch =' ';
	char letterList[] = {'a', 'b', 'c', 'd','e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};




	cout << "\nPlease enter a word: ";

	cin >> word;

	cout<<"The word contains "<<word.length()<<" characters."<<endl;



	while (ch != '0')
	{
		cout << "What letter would like to guess? (Enter zero to quit). ";
		cin >> ch;

		LetterArray (letterList, ch);

		for (int i =0; i < 26; i++)
		{
			if (ch==letterList[i])

				cout <<"\nThere are "<<numb_count[i]<<" "<<ch<<"'s"<<endl;
		}




	}
cout<<"You found these letters \n"<<endl;
	for ( int i=0; i<26; i++)
	{
		if (numb_count[i] > 0)
		
	cout<< letterList[i]<<"   ";
}

	cout << "\nThanks you"<<endl;


	system ("PAUSE");
	return 0;
	//end main

}





void LetterArray ( char letterList[], char ch)
{
	int counter;
	
	
		
		for (int count = 0; count < word.length(); count++)
		{
			if (ch == word[count])
			{
				for (counter =0; counter< 26; counter++)
				{
					if (ch == letterList[counter])
						numb_count[counter]++;
				}
			}
		}
	


}
void count (int numb_count[])
{
}


Thanks for the no help
closed account (zN0pX9L8)
Hey, no one had time to reply, so don't be a dick you little slut.
I would respond to the "Thanks for the no help" but I am unable to find sufficient insults. My apologies.
Last edited on
closed account (z05DSL3A)
I'm glad to be of no help!

I hope to be of no help in the future.
the replies on this thread have got to be the funniest I've read on the entire forum!

keep up the great work guys, without your comedic personalities and quick put downs it just wouldn't be the same
Are you sure you want help with that? Perhaps an extra topping?
Rofl I just came on the thread yesterday, and thought this forum was dead, but from looking at these replies it seems not that much dead, although the cummunity is a bit empty.

Oh and for the "thanks for no help" keep it to yourself, whenever I am in that same situation I try to figure it out on my own know that no one is obligated to help you.
Topic archived. No new replies allowed.