61.9k views
2 votes
Write the program that prompt user to enter number of students anf each student name anf score.finally fisplay the student with highest score

User Nisba
by
5.7k points

1 Answer

3 votes
var
x, y: integer;
top_student, temp_student: string;
top_score, temp_score: double;
begin
top_score := 0
showmessage('Please enter the number of students into the text box 1');
x := StrToInt(textbox1.text);
if x > o then
begin
for y:= 1 to x do
begin
temp_student := inputbox('student name', 'Please enter student name', '');
temp_score = StrToFloat(inputbox('student score', 'Please enter student score', ''));
if temp_score > top_score then
begin
top_score := temp_score;
top_student := temp_student;
end;
end;
showmessage('The top student is ' + top_student + ' with a score of ' + FloatToStr(top_score));
end;

end;
User Dutchman
by
5.2k points