473,399 Members | 3,106 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

plz help me..

1
hi all, am new here and i have a question in c++ am taking cs1 course , soo am a beginner ..i have an assignment question so plz if any one can solve it to me am thankfull..the question is::

Write a program that finds students who score the highest and lowest average marks of the first two homework in CS (I). Your program should read the data from a file called "hw.txt" and displays the output to another file called “results.txt”. The first line of the input file contains the number of students, n. The next n lines contain information about each student. Each data line contains the student name (first name and last name) and his/her marks, each out of 30.
The output should display all student names, marks, and grades. In addition your program should calculate and display the highest and lowest marks along with the name of the student. Also, your program should calculate and display all the average and the grade of the entire class. (See sample input/output). Also, see table for assigning letter grades.

A B C D F
(90-100) (80-89) (70-79) (60-69) (Less 60)


If your input file contains:

20
Mohamed Al-Ayoubi 21 18
Hiba Ahmed 22 14
Abeer BentMoussa 24 26
Ahmed Akibah 20 28
Noura Al-Kaabi 23 20
Abdullah Al-Souyaidi 18 28
Khori Abdullah 28 29
Eman Al-Harriri 25 29
Hithem Abu-Falafel 20 27
Aishamel Muqabal 21 20
Mounir Al-Arabi 20 28
HudaAmel Al-Khamissi 21 13
Huda Al-Ourbani 23 23
Mohamed Al-Sheikh 25 29
Rawshan Al-Nawaz 20 28
Saifeddin Al-Hashmi 22 26
Mohamed Al-Kawtahri 26.5 21.5
Abdullah Al-Badilz 19 25
Ibrahim Al-Khaboussi 25 15
Allaa Al-Maliki 29 19

The output should look like:

Student Name Mark1 Mark2 Avg. Mark Grade
--------------------------------------------------------------------------------------------------------------------
Mohamed Al-Ayoubi 21.00 18.00 19.50 D
Hiba Ahmed 22.00 14.00 18.00 D
Abeer BentMoussa 24.00 26.00 25.00 B
…………. ….. ……. …….. …..
Allaa Al-Maliki 29.00 19.00 24.00 B

The Maximum average mark is: 28.50 Scored by : Khori Abdullah
The minimum average mark is: 17.00 Scored by : HudaAmel Al-Khamissi

The average of the class: 23.29
The Grade of the class: C
Mar 22 '08 #1
2 1666
sicarie
4,677 Expert Mod 4TB
The experts on this site are more than happy to help you with your problems but they cannot do your assignment/program for you. Attempt the assignment/program yourself first and post questions regarding any difficulties you have or about a particular function of the code that you don't know how to achieve.

Please read the Posting Guidelines and particularly the Coursework Posting Guidelines.

Then when you are ready post a new question in this thread.

MODERATOR
Mar 22 '08 #2
hi all, am new here and i have a question in c++ am taking cs1 course , soo am a beginner ..i have an assignment question so plz if any one can solve it to me am thankfull..the question is::
How about this for a start? Break up the problem into managable pieces, try to get a piece to run and ask questions of the group to specific problems. Looking at the assignment I would group the "pieces" as follows:

decide on a data structure to keep the student information; name grade, average...

and now, for each line in the file...
read text from a file a line at a time
is it the first line? Yes: get the header data and save it
No: seperate (parse) the text of the line read into the data structure
until there are no more lines in the input file

now, for each student record in the data structure
compute the new information
format a string with the new information
write that updated student record to the output file

I won't give more detail than that, but I do have questions for you:
How do you read data from a file?
How do you write data to a file?
How do you format a string with text and numbers?
How do you store information in an ordered "pile" (data structure)
How do you create a data structure when you don't know how many student records there will be? The student file can have no records or three hundred records (a big class I am sure but you get my point)

These questions should expose those areas where you may need specific help. Start by taking any one sub problem and write a test program to try your solution. If you can't see the whole solution then start with pieces, then tie it all together.

Good luck and good coding!
Mar 23 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: William C. White | last post by:
Does anyone know of a way to use PHP /w Authorize.net AIM without using cURL? Our website is hosted on a shared drive and the webhost company doesn't installed additional software (such as cURL)...
2
by: Albert Ahtenberg | last post by:
Hello, I don't know if it is only me but I was sure that header("Location:url") redirects the browser instantly to URL, or at least stops the execution of the code. But appearantely it continues...
3
by: James | last post by:
Hi, I have a form with 2 fields. 'A' 'B' The user completes one of the fields and the form is submitted. On the results page I want to run a query, but this will change subject to which...
0
by: Ollivier Robert | last post by:
Hello, I'm trying to link PHP with Oracle 9.2.0/OCI8 with gcc 3.2.3 on a Solaris9 system. The link succeeds but everytime I try to run php, I get a SEGV from inside the libcnltsh.so library. ...
1
by: Richard Galli | last post by:
I want viewers to compare state laws on a single subject. Imagine a three-column table with a drop-down box on the top. A viewer selects a state from the list, and that state's text fills the...
4
by: Albert Ahtenberg | last post by:
Hello, I have two questions. 1. When the user presses the back button and returns to a form he filled the form is reseted. How do I leave there the values he inserted? 2. When the...
1
by: inderjit S Gabrie | last post by:
Hi all Here is the scenerio ...is it possibly to do this... i am getting valid course dates output on to a web which i have designed ....all is okay so far , look at the following web url ...
2
by: Jack | last post by:
Hi All, What is the PHP equivilent of Oracle bind variables in a SQL statement, e.g. select x from y where z=:parameter Which in asp/jsp would be followed by some statements to bind a value...
3
by: Sandwick | last post by:
I am trying to change the size of a drawing so they are all 3x3. the script below is what i was trying to use to cut it in half ... I get errors. I can display the normal picture but not the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.