problem at excercise with loops.

so the excercise is this:
a football team has between 12 and 15 players.we must insert some information on these players.The standard for a team is to have 12 players so after the info on the first 12 players are given it must ask if there are more players and the answer must be "yes" or "no".the loop ends when the answer is "no" or when the counf of players is 15.
I don't know what to do after i insert the information for the first 12 players. what loop do i use and or what decisions and how i put them together.
Thanks in advance for any help and tips. :)

This is my code so far.I know it's incorrect and most probably it needs lots of corrections.
#include<iostream>
using namespace std;
int main(){
string name,maxname,ans;
int i,height,age,cnt=0,cntforeign;
char fl;
float avgage;

do{
cout<<"give name of football player: "<<endl;
getline(cin,name);
cout<<"give his age: "<<endl; cin>>age;
cout<<"give his height: "<<endl; cin>>height;
cout<<"is he local or foreign? L/F"<<endl; cin>>fl;
cnt++;



}while(cnt<12);
cout<<"are there more players? yes/no "<<endl;
cin>>ans;


while (cnt>=12&&cnt<=15&&ans=="yes");{


cout<<"give name of football player: "<<endl;
getline(cin,name);
cout<<"give his age: "<<endl; cin>>age;
cout<<"give his height: "<<endl; cin>>height;
cout<<"is he local or foreign L/F?"<<endl; cin>>fl;
cnt++;
cout<<"are there more players? yes/no "<<endl;
cin>>ans;
}

return 0;

}
Last edited on
Hello and welcome!

Please specify what your problem with this particular exercise is. Otherwise it will be hard to provide any help. Also if you have code post it.
Topic archived. No new replies allowed.