- 1
my code has an empty line between each case of out put.but dont have any white space in start of line and my code has presentation Error.???
B.Sadat said:
my code has an empty line between each case of out put.but dont have any white space in start of line and my code has presentation Error.???
read the other topics in this discussion if you don't found your answer,so give me your code!
include
include
using namespace std;
void pushing(vector& v,int n){
int d;
for(int i=0;i<n;i++){
cin>>d;
v.pushback(d);
}
}
void undercut(vector& scores,int n){
vector v1,v2;
int scoreA=0,scoreB=0;
pushing(v1,n);
pushing(v2,n);
for(int i=0;i<n;i++){
if(v1[i]==1 && v2[i]==2)
scoreA+=6;
if(v1[i]==2 && v2[i]==1)
scoreB+=6;
else{
if(v1[i]-v2[i]==1)
scoreB+=v1[i]+v2[i];
if(v2[i]-v1[i]==1 )
scoreA+=v1[i]+v2[i];
}//end of else
if(v1[i]-v2[i]>1)
scoreA+=v1[i];
if(v2[i]-v1[i]>1)
scoreB+=v2[i];
}//end of for
scores.pushback(scoreA);
scores.push_back(scoreB);
}
int main(){
int n=1;
vector scores;
while(true){
cin>>n;
if(n==0)
break;
undercut(scores,n);
}
for(int i=0;i<scores.size();i+=2)
cout<<"A has "<<scores[i]<<" points."<<" B has "<<scores[i+1]<<" points."<<endl;
return 0;
}
please tell me what is problem of this code?
In order to post something you must login first. You can use the form in the top of this page.