#include <iostream>
using namespace std;
int main(){


double w,x,y,z,avg;



cout <<" PLEASE ENTER FOUR ENTRIES OF MARKS"<<endl;
cin >> w >> x >> y >> z;


avg=((w+x+y+z)/4);
if(avg>60){
cout <<"YOU PASS"<<endl;}


else{
cout<<"YOU FAIL"<<endl;
}
cout<<"YOUR AVERAGE MARK IS "<<avg<< endl;


return 0;


}

Think loop any time you want something to repeat. Just pick an appropriate control conditional for the loop and include any code you want to repeat within the body of the loop and you should be well on your way. If you don't already know there are three types of loops call for, while and do/while. Looking them up on a toutorial or in your favorite textbook is highly recommended.

if you want is to loop infinitely just stick the main part in a while loop and use a condition that is always true like:

while(1 == 1)
{
//your code
}

.

the do loop performs the operation first then checks the condition, useful for file ops.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.