Output:
User input : "this is a test"
Search character: "h"
This program will inform the user that the text contains 1 h.
The user will enter EXIT on the command line to terminate program ( while loop "exit" !=0)
Function require:
get_user_input() - will func gets() to get command line
parse_command_line() - will prompt the user for the search character then search the command
** This func will call the func display_results()
Display_results() - display string search.
-------------------------------------------------------------
My program was working fine without these prototypes. But it's really confused me when I try to put all the func together. Please help me out. Thank you.
Code:#include "stdafx.h" #include "conio.h" void get_user_input(char[80]); void parse_command_line(char[80]); int display_results(void); int _tmain(int argc, _TCHAR* argv[]) { char userInput[80],search[80]; int count=0; int i=0; get_user_input(userInput); parse_command_line(search); display_results(); getch(); return 0; } void get_user_input(userInput);{ printf("User Input \n"); gets(userInput); } parse_command_line(search){ printf("\n The search character is \n"); gets(search); for (i=0;i<80;i++) { if(userInput[i]==search[0]) { count++; } } } int display_results(void){ printf("The string contains %d ",count); }