944,066 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 1449
  • C++ RSS
Apr 23rd, 2005
0

How can I write this coding?

Expand Post »
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
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
pink is offline Offline
6 posts
since Apr 2005
Apr 23rd, 2005
0

Re: How can I write this coding?

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.
Reputation Points: 14
Solved Threads: 4
Junior Poster
prog-bman is offline Offline
108 posts
since Nov 2004
Apr 23rd, 2005
0

Re: How can I write this coding?

Please provide full code and write down exactly what is what they want from you at school
Moderator
Featured Poster
Reputation Points: 2786
Solved Threads: 874
Code tags enforcer
peter_budo is offline Offline
6,659 posts
since Dec 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: How can I write this program.
Next Thread in C++ Forum Timeline: total newb - "passing arg 2 of `strcpy' makes pointer from integer without a cast"





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC