English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

The user must be able to enter a string of any amount of characters and the output must count only one specific character. Thank you.

2007-02-14 13:47:46 · 3 answers · asked by Bernard 2 in Computers & Internet Programming & Design

3 answers

there is a string function that will do that, I just cant remember what its called. look in the string.h file, or documentation you have for the string functions.

another way is as the other person said. its a pretty easy routine to write, just try it.

2007-02-15 01:20:56 · answer #1 · answered by justme 7 · 0 0

An if statement iterating through the string until it finds the null.... A simple counter variable with an if statement that adds one to the counter every time target is found...

2007-02-14 13:57:16 · answer #2 · answered by Anonymous · 0 0

In pseudo code, via fact i attempt to steer away from writing somebody's homework for them: define index a million define intcount 0 define charcount 0 define maxlength 0 define array[] = "12players2teams" maxlength = stringLength(array) loop till index == maxlength    if isCharAt(array[index])       increment charcount    else if isIntAt(array[index])       increment intcount end loop output "Integer count quantity = " + intcount + " character count quantity = " + charcount

2016-10-02 03:59:06 · answer #3 · answered by ? 4 · 0 0

fedest.com, questions and answers