+ 1
Write a programm to enter the name of user and his marks diaplay the name of user and average of marks
plz help
16 Réponses
+ 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.
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.
0
how
0
plz help me
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?
0
ya
0
I know the basics
0
can u type the code fr me from clr scr ();
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.
0
can u plz write it
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.
0
#include(conio.h)
#include(iostream.h)
#include(math.h)
void main()
{
clrscr();
0
can u type the nxt Line
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.
0
thanks next
0
next what shul I do