Monday, May 24, 2010

Write a C++ program?

Write a C++ program that contains a structure named “Student” having two data members 1) Name2) CGPADeclare array of structure “Student” of size 10 .Populate this array by taking data from file inputFile.txt.File inputFile.txt contains Name and CGPA of the students for current semester. There is a single space between the Name and CGPA.Display the un-sorted list of students on screen. Compare the CGPAs of all the students and sort Student List with respect to CGPA in ascending or descending order.Display the sorted list of students, highest CGPA and lowest CGPA on screen and also write the result in File outputFile.txt with tab characters between the Name and CGPA.

Write a C++ program?
Sounds like a fun homework assignment for YOU TO DO YOURSELF.
Reply:I'd use a spreadsheet instead of C++. I'd copy the text file into the spreadsheet. Then the data can be sorted easily just go to data and sort. If this is for a class your book will tell you the correct commands to input, sort the data and then output the data into a text file. I have never used C++ but in basic an array was a place to store data. I would think you could use input or a similar command to input the data from the file then use display or a similar command to show the file on screen. Then use sort or a similar command to sort ascending or descending. Then use display or a similar command. Then use write, output or a similar command to make the output file.
Reply:read a tutorial and do it yourself, it's really easy.
Reply:how about in php?


No comments:

Post a Comment