Click here to Skip to main content
15,884,388 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
hello again friends;

in vb.net console applications,i want to accomplish the following;

for a specified string input like "greetings"
i want the console to respond "hello" for the first time,as for the second,third and fourth times(any value that is >1) i want the console to respond "you already said that" or just pick the respond from a list of random strings. what would be the code or function for this?

Your answers are much appreciated..
Posted

1 solution

This is not how CP usually works. Most important goal here is to learn and help learning.
You are supposed to try it on your own, and come here when you got stuck with something, with a concrete question about your code, design, etc.
Please have a look to What have you tried?[^] to see a good explanation about what I mean.


What you are asking is something it should not be difficult. Start a program, try it on your own and if you don't manage to solve it... Then come back and add the code you tried to the question using "improve question" widget. So we can correct it and explain your errors.
if we give you a ready-to-go solution, it is not going to help you because you are not going to learn anything from it.


I recommend you to start with a very simple way, just checking for only one string.
I mean, you save the "hit-string" in a variable, wait for the user input, check it and count up until you write (in example: "reset").

When that is working you can start making it more difficult, saving a list of strings in an array and comparing them or making a tiny class with a string, a repetition counter and a flag "already said"
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900