473,395 Members | 1,742 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

I want C++ to count the letters i want it to count after asking me to provide a word

1
hi! i had actually joined a contest which puzzled me a lot. in return, i want to figure it out. i tried a lot of options and coding stuff but none of them worked. so, i decided to come to an expert.

my issue is kind of like this:

i want to create a C++ program that will ask me to enter a word. After then, it will ask me again to enter a letter i want my program to count for me. If the letter i will provide is in the word i previously provided, it will give me an exact number of its occurence. Hence, it will prompt me an error message saying that the letter i'm asking is not in the word i provided.

to anybody who's familiar with my issue, please do help me by replying to this message. it would be highly appreciated.

thanks ú

little
Sep 18 '07 #1
1 1391
gpraghuram
1,275 Expert 1GB
hi! i had actually joined a contest which puzzled me a lot. in return, i want to figure it out. i tried a lot of options and coding stuff but none of them worked. so, i decided to come to an expert.

my issue is kind of like this:

i want to create a C++ program that will ask me to enter a word. After then, it will ask me again to enter a letter i want my program to count for me. If the letter i will provide is in the word i previously provided, it will give me an exact number of its occurence. Hence, it will prompt me an error message saying that the letter i'm asking is not in the word i provided.

to anybody who's familiar with my issue, please do help me by replying to this message. it would be highly appreciated.

thanks ú

little

Hi,
This is a very simple problem and i doubt whether this is a contest problem.

I can give the idea of how to go about it.
1)As u get the word, read character by charecter and store it into a map in which the charcter is the index and the number of occurance is the value.
2)Then after getting the character search in the map and print the count or else print the error..

Thanks
Raghuram
Sep 18 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: jester.dev | last post by:
Hello, I'm learning Python from Python Bible, and having some problems with this code below. When I run it, I get nothing. It should open the file poem.txt (which exists in the current...
19
by: Johannes Nix | last post by:
Hello, yesterday I met a cute person (after my dance class) who told me about an interesting experiment regarding cognition. People were told to read a typed text; However, in every word in the...
9
by: dan | last post by:
this is a program to count average letters per word. i am able to count the total number of letters, but not words. How do you count the total number of words in a text file, so i am able to divide...
11
by: Sandfordc | last post by:
I have tried several time to do this but have been unsucessful. I tried something like: myFunction(charater) str=frm.s1.value sb1=str.substring(0,charater)...
7
by: Dung Ping | last post by:
Such as: <script> //code aaaa zzzz ccc
7
by: achristoffersen | last post by:
For my thesis I'm using access to analyze news-articles. I would like to calculate readability score. But I don't know how. I have a very simple word count already, and I also have an...
2
by: Stijn Verrept | last post by:
You have a grid like this: Y Y F O U R G F O U R G F O U R Y G G U R U O F Y R Y R Y G How many times does this grid have FOUR in it?
12
by: KWSW | last post by:
Got this assignment due a few weeks later and since I am done with the up coming assignment, decided to try out the next one early rather than rush later. First part of it requires me to do a...
4
by: abueno | last post by:
//It should count how many characters are letters in the English alphabet, and is displaying the correct letters, but is not counting good. void FunctionCountLetters(char s) { int len; int i;...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.