+ 1

help me!! this question want using by while statement. help me pleaseeeeee. i need it tomorrow before 10 a.m

float marks,totMarks = 0, average; int cnt = 0 for (cin >> marks; marks >=0; cin >> marks) { totMarks = totMarks + marks; cnt++ cout << ":marks =" << marks << endl; } average = totMarks / cnt; cout << "average marks=" << average << endl;

21st Dec 2016, 4:34 PM
Iffa Fiffy
Iffa Fiffy - avatar
8 ответов
+ 5
As I wrote it. Not sure if it can be done with other way...
21st Dec 2016, 5:27 PM
Valen.H. ~
Valen.H. ~ - avatar
+ 4
float marks,totMarks = 0, average; int cnt = 0 while (marks >=0) { cin<<marks totMarks += marks; cnt++ cout << ":marks =" << marks << endl; } average = totMarks / cnt; cout << "average marks=" << average << endl; ----------------------------------------------------------- Not sure if functional tho~
21st Dec 2016, 4:41 PM
Valen.H. ~
Valen.H. ~ - avatar
+ 4
What do you want it to do?
21st Dec 2016, 5:01 PM
Valen.H. ~
Valen.H. ~ - avatar
+ 4
I already rewrote it with while, see comments above...
21st Dec 2016, 5:09 PM
Valen.H. ~
Valen.H. ~ - avatar
+ 2
im not sure. thats why i ask
21st Dec 2016, 5:00 PM
Iffa Fiffy
Iffa Fiffy - avatar
+ 2
i want creat a program by using while statement based that program. can you help me?
21st Dec 2016, 5:04 PM
Iffa Fiffy
Iffa Fiffy - avatar
+ 2
oh. okay. i forgot it.. thanks for helping :)
21st Dec 2016, 5:16 PM
Iffa Fiffy
Iffa Fiffy - avatar
+ 2
if question want it by loop statement, how is it in program?
21st Dec 2016, 5:25 PM
Iffa Fiffy
Iffa Fiffy - avatar