+ 2

could you help me please I don't understand how to solve this question>_<

write a program request from user ( name , level , department, subject, and marks ) then print information that entered by user and sum of marks and average , then check if he / she pass or failed.

5th Jun 2017, 4:14 PM
Ahmed Abofteem
Ahmed Abofteem - avatar
12 Réponses
+ 9
yes , you can use string or char , but in char you have to determine the size of the name , so I wrote ..char name[100]; in this I wrote size 100.. because may the user has 100 letter to write in his name
6th Jun 2017, 1:30 PM
Enas Emad
Enas Emad - avatar
+ 8
first you should declare name and level and department . second get the input from the user . remember declare each variable with the appropriat data type for example : char name [100]; int level;
6th Jun 2017, 12:37 PM
Enas Emad
Enas Emad - avatar
+ 7
*first get input from the user by using cin>> . *second print the information by cout << *third check this code . it will help you *if you have any dout ask . and I will explain . https://code.sololearn.com/cfzN6CbuwcLN/?ref=app
5th Jun 2017, 5:09 PM
Enas Emad
Enas Emad - avatar
+ 6
Since it's homework, it's better that you don't get a direct solution. Else you won't actually learn how to code and it's all for nothing, Divide the assignment into segments and then learn more about them. So, learn how to receive input from user, the input data types, how to print information, how to do the calculations and how to check passing or failing.
5th Jun 2017, 11:14 PM
Taija
Taija - avatar
+ 4
Is this for an assignment at school or something? Well, I reccomend using templates to hold the information then checking for invalid entries and promoting the user for new input. If you've been given no guidance as to what constitutes a passing mark, why not ask for user input for that, too? If you wanted to go overboard you could use iostream to export the grades to a text file for printing and the grade settings to a text file for loading next time. You might get some points for going above and beyond, but you might also lose some for being a smart arse. :p
5th Jun 2017, 5:53 PM
Smellfungus
+ 3
Question may be to vague. Could be done as simply as this (Which I assume isn't what you want): int mathMark; cin >> mathMark; int englishMark; cin >> englishMark; int sum = englishMark+mathMark; int avg = sum / 2 cout << "Average mark: "+avg+"\nSum of marks: "+sum;
5th Jun 2017, 5:07 PM
Rrestoring faith
Rrestoring faith - avatar
+ 1
thank you all :) I'm a beginner at c++ and I want to develop my self and about the question it's one of my homeworks I don't know how can I solve it , it seems difficult to me , also thank you sister Enas Emad your name like my teacher at this subject ^_^
5th Jun 2017, 6:09 PM
Ahmed Abofteem
Ahmed Abofteem - avatar
+ 1
Thank you very much sis that's kind of u ^_^
5th Jun 2017, 6:18 PM
Ahmed Abofteem
Ahmed Abofteem - avatar
+ 1
cool , thanks
6th Jun 2017, 1:32 PM
Ahmed Abofteem
Ahmed Abofteem - avatar
0
Thanks for your advice sister Taija , I will do that in sha'a Allah :)
6th Jun 2017, 1:23 AM
Ahmed Abofteem
Ahmed Abofteem - avatar
0
excuse me frnds what about name , level and department how can I do them ?
6th Jun 2017, 12:12 PM
Ahmed Abofteem
Ahmed Abofteem - avatar
0
@Enas why you don't use string to declare name, level… etc and getline ?
6th Jun 2017, 1:27 PM
Ahmed Abofteem
Ahmed Abofteem - avatar