How to declare marks from the user ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to declare marks from the user ?

I want to write the marks of the subjects from the user so how can I do that ?

30th Jun 2017, 5:03 AM
Ahmed Abofteem
Ahmed Abofteem - avatar
6 Answers
+ 9
What language?
30th Jun 2017, 5:25 AM
Hatsy Rei
Hatsy Rei - avatar
+ 7
So you just declare the same amount of variables as the number of subjects and have the user input it. (Or you can use arrays) int cplusplus, ruby, java; cout << "Please input some marks"; cin >> cplusplus; cin >> ruby; cin >> java;
30th Jun 2017, 7:02 AM
Hatsy Rei
Hatsy Rei - avatar
+ 5
Sounds very similar to a homework assignment I have seen mentioned here on more than one occasion. 😀 If you can you should do a search on the forums or in codeplayground and you may just find exactly what you need
30th Jun 2017, 5:35 AM
jay
jay - avatar
+ 5
@Calvin: Pretty sure it is c++
30th Jun 2017, 6:12 AM
jay
jay - avatar
+ 3
I guess he might look for way to declare a array holding marks. Different languages has different declaration, what language you use?
30th Jun 2017, 5:59 AM
Calviղ
Calviղ - avatar
+ 1
I'm using c++
30th Jun 2017, 6:58 AM
Ahmed Abofteem
Ahmed Abofteem - avatar