Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
hello friends this is priya...
i hope u people will help me with the following question
the question is :
Write a program to process a set of student marks.Each line of the data contains a person's name (a single word) followed by five marks. Each mark should be an integer between zero and 10 inclusive.
Your program should:
1.·print the name and average mark for each student to two decimal places
2.print the total number of students processed
3.·print the overall average to two decimal places
The input should come from a file called data.txt. The output should be printed to standard output.
Last edited by priya sweet; 09-22-2012 at 04:19 AM.
This code is to be done in c++
we have entered name and marks of 5 subjects of a student in one line
and while writing it to standard output we have displayed the line up to that i am done. My doubt is that later how to find avg of a particular student and of whole students that i am not clear. soo please can u give me idea about how to do that .
Have you studied the C++ functions for handling strings? One thing you will need to do is extract the five "marks" one each line into variables (I think an array is probably the best approach). If you have the marks in an array, then you cam simply use a loop to step thru the array and add up the values. Then divide by 5.
I believe that, from your requirements, it is expected of you to first parse the input file using an appropriate data structure (given that we're talking about C++, this would likely be a class) to contain the information about every student (namely: the name and the 5 marks) and then you should write appropriate methods to process this data and produce the results required in your assignment.
If you don't know how to parse a single line of input, you can make use of the C fscanf function like this: