"Build a Weather App with Swift" was retired on May 31, 2020. You are now viewing the recommended replacement.

Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS

HELP!!

Hey everyone, I am very new to coding, and I will need to be helped out quite a bit at the beginning. I am very excited about it though, and look forward to learning lots more about it, and I have a dream of one day making my own website and iPhone app :) I am currently stuck though on the challenge task for the iOS Development track, under the Fundamentals of C course in the variables lesson for challenge task 1. I have tried the code probably 50 times in different ways, but even on the preview it pulls up a blank and I am at a loss. The challenge is to create a "float variable for 'radius' is equal to '14.5'. Here is my code that i have continued to tinker with.

include <stdio.h>

int main() { float 'radius' = 14.5;

    printf("%f radius.\n", radius);

    return 0;

}

5 Answers

Colton,

glad you're excited about coding, but it looks like you gave the compiler a little more than what it was asking.

so if we break the question down. Create a float variable named 'radius' with the value '14.5'.

simply, only do just that.

your first line is correct. with the exception of the single quotes.. everything else following can wait && it may be used in part two of the code challenge.

Wow! Thanks so much! That was exactly it!! Thanks for the help!! It just went through. I guess I got a little excited and did the whole C formula haha

lmao, its cool man. btw, probably the most difficult thing in programming to me is understanding what the question is asking, after you figure out what it's asking, implementing the code should be a breeze.

That's good advice, not to pester you more, but how then do I make a printf statement? I am adding the text in the quotations after the %f but it is saying not to make a NSSAstring but a normal printf string? You get it? haha

you're not bothering me, i actually wish people would really ask more questions in the forums i don't think they ask enough.

However, you already have the syntax(meaning arrangement, but programmers use the word syntax instead) correct in your answer above. but i believe the question wants you to use that float value you created in a sentence.

i know exactly where you're struggling. look at it like this.. The sentence in the instructions reads "A ball with a radius of 14.5 inches."

well, the question wants you to use that float value you created. They want you to use the value you created to complete the rest of this sentence. So until you 'substitute' it in the sentence, the sentence basically reads like this "A ball with a radius of ___ inches."

with that being said, when you use the printf statement with that sentence that the instructions gave you, you have to think.. how can i fill in this blank with the float value i just created? Then you're like, oh yeah i use %f to substitute for the blank.

so now that you filled in the blank your printf statement should read "A ball with a radius of %f inches." because you filled in the blank.

I answered your question but didn't give you the full answer, let me know if you get it.

I´m at the same Challenge right now and cannot figure out whats wrong:

Thats my code:

int main() { float radius = 14.5; }

Can you help me out?

I tried the same piece of code in a different browser and it worked... weird

hmm, that's weird. I was going to say that within the code challenge there's no need to insert the main argument. just declare and assign the value to the float. but good job man.

It happened once before (a year ago or so), that the code challenge wouldn´t accept any code, which was solved by changing the browser