Has anyone solve the challenge: using readline(), I do not understand the question can i cannot solve it. Any sample answer as reference?
Here’s what I got. It’s pretty straightforward when you use the chapter 8 code.
#import <Foundation/Foundation.h>
#import <readline/readline.h>
int main(int argc, const char * argv[])
{
@autoreleasepool {
printf("Where should I start counting?");
const char *num = readline(NULL);
NSString *newnum = [NSString stringWithUTF8String:num];
for (int i = atoi(num); i >= 0; i -= 3) {
NSLog(@"%@",newnum);
if (i % 5 == 0) {
printf("Found one!\n");
}
}
}
return 0;
}