lundi 29 juin 2015

Selecting label and then export into a new label

I have a little problem here. So I do not mean my English ;-)

I have 3 generate numbers here in 3 different label.

Number 1:

-(IBAction)rechneAdd:(id)sender {
float erg = ([label1.text floatValue]) + ([label2.text floatValue]);
label3.text = [[NSString alloc] initWithFormat:@"% g", erg];
NSLog(@"Ergebnis 1 = % g", erg);
}

Number 2:

-(IBAction) rechneErgebnis:(id)sender {
float erg = ([label3.text floatValue]) + ([label4.text floatValue]);
label5.text = [[NSString alloc] initWithFormat:@"% g", erg];
NSLog(@"Ergebnis 2 = % g", erg);
}

Random number 3:

- (IBAction)Zufallszahl4:(id)sender {
Zufallszahl4 = random() % 2 ? 1 : -1;
label6.text = [NSString stringWithFormat:@"%i", Zufallszahl4];
NSLog (@"Zufallszahl 4 = %i", Zufallszahl4);
}

Now, if the random number 3, the result "1" returns, then the result is output the Number 1 in the new "Label1". If the random number 3, the result "-1" returns, then the result is output the Number 2 in "Label1".

Unfortunately do not continue... I hope you know what I mean Do you have a useful idea about this? Thank you very much, Christian




Aucun commentaire:

Enregistrer un commentaire