을 반환하는 방법을 알고 싶습니다 확실히 무엇을 성취하려고 노력하고있어.
-(void)setNumberOfCoins:(float)arg1
메서드는 부동 소수점 값을 사용하여 처리합니다.
-(void)setNumberOfCoins:(float)arg1 {
float someFloat = arg1 * 2.0f;
float anotherFloat = arg1 * 4.0f;
float andAnotherFloat = arg1 * 8.0f;
NSLog(@"The value of someFloat is %f",someFloat);
NSLog(@"The value of anotherFloat is %f",anotherFloat);
NSLog(@"The value of andAnotherFloat is %f",andAnotherFloat);
}
그리고 그것을 사용하는 :
float numCoins = 2;
[self setNumberOfCoins:numCoins];
출력 : 예를 들어
The value of someFloat is 4
The value of anotherFloat is 8
The value of andAnotherFloat is 16
이 좀 더 구체적으로 할 수 있습니까?
본때를 보여 줄 때마다 float 값을 수정하는 방법을 알고 싶습니다. –