vendredi 27 février 2015

C - Compare a list of numbers to array



I'm taking a list of numbers that are strings and comparing them to a list of numbers that are strings in an array. When a number in the list matches a number in the array, "Match Found" is displayed. For the matching numbers nothing else should be displayed. For number 6, "Match Not Found" is displayed.


List: 12346


Array: 12345


Note:



while(not end of file)
{
for(i = 0; i < arraycount; < i++)
{
if(strcmp(numberlist.numbers,array[i].numbers) == 0)
//Display "Match Found"
}
}


I'm not sure what to do after this point or if I'm even approaching this right. If I put an else statement that displays "Not Found" after the if statement then this is displayed for the "Match Found" numbers.


This is for a beginners class, so I have to keep the code at a beginners level.




Aucun commentaire:

Enregistrer un commentaire