Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

真心伤不起啊!sizeof()与strlen(),60的区别!用strlen()函数正确,其他不正确!!用60输出多余的‘‘\n’!

Posted by 20124233 at 2014-05-12 13:57:11 on Problem 2070
#include<iostream>
#include<stdio.h>
#include<string>
using namespace std;
int main()
{
    double s,w,l;
    while(cin>>s>>w>>l&&s*w*l!=0)
    {
	          char ss[100]="";
             if(s<=4.5&&w>=150&&l>=200){strcat(ss,"Wide Receiver ");};
             if(s<=6.0&&w>=300&&l>=500){strcat(ss,"Lineman ");};   
			 if(s<=5.0&&w>=200&&l>=300){strcat(ss,"Quarterback ");};
		     if(strcmp(ss,"")==0)cout<<"No positions"<<endl;
              else{
                 for(int i=0;i<strlen(ss);i++)//
                    cout<<ss[i];
                 cout<<"\n"; 
              }   
    }
    
    return 0;
} 


Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator