+ 1

Write a programm to enter the name of user and his marks diaplay the name of user and average of marks

plz help

30th Jan 2017, 3:55 AM
insan khan
16 Antworten
+ 1
You should really start with something easier if you can't even get to line 2, just saying... It's already quite late for me so this will be my last reply for today. Start by declaring the variables you need (name, number of marks and an array to store the marks) and try to get the user input done using cin. For the marks you'll need an array that gets the user input for each of the marks (that's why you need to know how many marks the user will enter). Just make it that each mark is it's own user input, don't try to read them all in in the same line (also possible, but a bit more complicated). That's all you need before you can start clalculating the average (for that you can use a for loop again, add the numbers up and divide them by the number of marks). Now you just need the output (using cout) and you're done.
30th Jan 2017, 4:30 AM
Robobrine
Robobrine - avatar
0
Do you have some code already? If not, what's the problem? Just start with the user input and we can work it out from there.
30th Jan 2017, 4:00 AM
Robobrine
Robobrine - avatar
0
how
30th Jan 2017, 4:00 AM
insan khan
0
plz help me
30th Jan 2017, 4:02 AM
insan khan
0
Well, I hope you did the c++ course (at least the first few modules) and know the basics now, so getting some user input shouldn't be a problem, right?
30th Jan 2017, 4:02 AM
Robobrine
Robobrine - avatar
0
ya
30th Jan 2017, 4:03 AM
insan khan
0
I know the basics
30th Jan 2017, 4:03 AM
insan khan
0
can u type the code fr me from clr scr ();
30th Jan 2017, 4:05 AM
insan khan
0
Then use your knowledge and to input first the name of the user, then the number of marks he has (this makes it easier to read and store them) and the use a for-loop to ask for each of the marks while storing them in a large enough array.
30th Jan 2017, 4:07 AM
Robobrine
Robobrine - avatar
0
can u plz write it
30th Jan 2017, 4:08 AM
insan khan
0
Nah, I just don't feel like it :P But feel free to post your progress here so I can point you in the right direction if needed.
30th Jan 2017, 4:10 AM
Robobrine
Robobrine - avatar
0
#include(conio.h) #include(iostream.h) #include(math.h) void main() { clrscr();
30th Jan 2017, 4:13 AM
insan khan
0
can u type the nxt Line
30th Jan 2017, 4:14 AM
insan khan
0
Ok, let's start with the includes, it's #include <filename.h> or, in the case of iostream without the .h main has the return type int, not void. No idea what you wan't with clrscr(), have never seen anyone use it and you won't need it here.
30th Jan 2017, 4:19 AM
Robobrine
Robobrine - avatar
0
thanks next
30th Jan 2017, 4:23 AM
insan khan
0
next what shul I do
30th Jan 2017, 4:24 AM
insan khan