Community Forums => General Chat => Topic started by: kirby_killer_dedede on August 16, 2005, 01:54:07 PM
Title: Help for newbie programmer...
Post by: kirby_killer_dedede on August 16, 2005, 01:54:07 PM
I'm interested in making a program, but being the newbie I am, I don't know what kind of coding to do or anything.
Anyway, the description of the program is as follows:
There is a list of symptoms for common sicknesses. The user then selects the symptoms they are experiencing. The program then searches for sicknesses that are attributed by all the symptoms selected. The sicknesses are then listed with full lists of symptoms for each sickness.
I don't imagine it will be a terribly complex program. I don't need it to necessarily look good or anything, just so long as it serves its purpose.
Please, this is urgent. If anyone can tell me how I can pull this off, it would be greatly appreciated.
Title: RE: Help for newbie programmer...
Post by: slacker on August 16, 2005, 08:11:25 PM
Well, you will need a collection (an array or a 2 dimensional array) that will contain a type of illnesses and a list of symptoms that belong to that illness. I will use a multi-dimension integer array to keep things simple. Here's a snippet:
// illness definition int flu = 9 int cold = 8;
// symptom definition int runningnose = 10; int cough = 9;
int illnesses[5][10]
ilness at position 0 will have the following symptoms: illness[0][0] = 10; illness[0][1] = 9;
Where 10 and 9 is a place holder for a particular symptom (like running nose). The first 0 in the first bracket denotes a particular illness (like the flu). So, first you have to come up with a way to define your illnesses. In this case, I use numbers. This will be your program's dictionary.
Now, you will need to get the user's input and compare it to the dictionary that was previously defined. You will have to loop through the entire multi-dimensional array and see which illness match up best. I would save the illness that has the most match in a temporary variable. Finally, by the time the program exit the loop, you will have an illness that match best, unless there is a tie. In that case, you will have to return multiple illnesses if you so choose or you can simply return the first illness. Now you can format the result in whatever fashion you want because the program knows what illness it is. In my example, you could simply return 8 for a cold, but of course the number 8 to a human don't mean much.
Hope this gets you going.
Title: RE: Help for newbie programmer...
Post by: KDR_11k on August 16, 2005, 10:10:16 PM
That's just a wrapper for an SQL query, you could do that in three lines with PHP or Perl on a webserver.
slacker: Aaaaargh! My eyes! What kind of coding style is that supposed to be??? At least use enums for the symptoms!
Title: RE: Help for newbie programmer...
Post by: slacker on August 17, 2005, 06:06:59 PM
This is a programming newbie so I thought I make it as general as possible. I was assuming that a newbie would attempt a console program first (like a Hello World) without the luxury of a database. Rather than go into the details of a particular language, I would just lay out the basic logic to implement in the program. Then kirby can go and attempt to write it out in whatever programming language. I didn't want to out right put up workable source code in case this is suppose to be a student's homework. Anyways, since there hasn't been any feedback, I'm assuming kirby is hard at work on the program or have given up.