int main (int argc, const char * argv[])
{
@selector(grades);
}
-(int)grades:(int)grade{
printf("Please write down your grade:");
scanf("%d", &grade);/*the grade value written has assigned to grade parameter*/
printf("\n");
if((grade > 100) || (grade <0)){/*This is a warning range of grades */
printf("Warning!!\nYour grade is out of range\nPlease write a NUMBER between 0-100\n");
}
else{/*The grade ranges are defined*/
if((0<=grade) && (grade<=20))
NSLog(@"Your letter grade is : F\nyou failed\n");/*NSLog has been used insted of printf*/
if((21<=grade) &&(grade<=40))
NSLog(@"Your letter grade is : D\nTry again\n");
if((41<=grade) && (grade<=60))
NSLog(@"your letter grade is : C\nNot bad\n");
if((61<=grade)&&(grade<=80))
NSLog(@"Your letter grade is : B\nWell Done\n");
if((81<=grade)&&(grade<=100))
NSLog(@"your letter grade is : A\nGreat !!\n");
}
return 0;
}
我有在方法聲明中的問題目標C缺失背景下,我想我檢查了,但我 不能發現任何錯誤 如果你們能幫助我,這將是巨大的。 謝謝的方法聲明
什麼的'@selector(等級)'?另外,不應該是'@selector(grades:)'? – Larme
你想完成什麼? '@selector(等級);'沒有做任何事情 –
它需要編譯檔次方法 – user3446544