954,498 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

How can I write this coding?

:sad: There is a programming question. This is searching program. there is a string array. In this string array ther is a sentence. I get a word from the user . When the user's word is match with the sentence that is in the string , a message will appear ( found!!) and the number of count else (Not found!!).
My coding:
main()
{
int count ;
char st1[80],st2[80];
char st[80]={ ncc education examination ncc ncc ncc education};
cout<< "Enter a word to be search";
cin>> st[];
int i=0;
{

while(st[i]!='/0')
{ st3[i]=st1[i];
st3++;
while((isspace(st[i])))
if( stcmp(st1,st3));
count++;
{cout<< "found";}
else {cout<<"Not fjound!!";}
}
st1[i]++;
}
}
Please test this program is wrong or true .If in this program have a little wrong please correct it

pink
Newbie Poster
6 posts since Apr 2005
Reputation Points: 10
Solved Threads: 0
 

1. Use complete sentences to describe what you are trying to accomplish so someone can understand what you are asking. So they do not have to lower themselves to a third grade level of reading to know what you are trying to ask.

2. Use code tags when posting code.

3. main returns an int it should be int main.

prog-bman
Junior Poster
109 posts since Nov 2004
Reputation Points: 14
Solved Threads: 4
 

Please provide full code and write down exactly what is what they want from you at school

peter_budo
Code tags enforcer
Moderator
15,436 posts since Dec 2004
Reputation Points: 2,806
Solved Threads: 902
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You