Mat
if(Fran && Cel == 0){ answer = (Fran - 32) * (5.0/9.0); printf("%f degrees fahrenheit equals %f degrees celsius\n",Fran,answer); } if(Cel && Fran == 0){ answer =((((Cel * 9.0) / 5.0) ) + 32.0); printf("%f degrees celsius equals to %f degress fahrenheit\n", Cel , answer); } You should use an else if here
Mat
Not sure why the other var should be 0 🤔
Mat
That was easy
Anonymous
Put it inside your while loop
the main issue i have is assigning both options at the same time
Anonymous
thats the one question you didnt answer ...
Anonymous
i am assuming it has something to do with optarg and switch statement
Mat
thats the one question you didnt answer ...
Put the stuff inside your while loop, inside the switch
Mat
With an outer if you'll never be able to do it
Anonymous
https://pastebin.com/sVMtX1KE
Anonymous
this works now how i intend @Occupato
Mat
That's really ugly
Mat
Sorry but I have to point it out
Anonymous
That's really ugly
thanks man . lol
Anonymous
i only on chapter 4 , out of 12
Anonymous
@Occupato not everybody is a cod god will a million years of experience like you my G, we all gotta start somewhere , dont be a hater
Anonymous
i am always up for constructive criticism tho
Mat
Do what you need inside the switch, i already told you that
Anonymous
Not hating, just sayin' you can improve that
so give advice on how to improve….lol
Mat
thanks
That's something nicer https://pastebin.com/pzmeTCvC
Anonymous
is pastebin down for you
Anonymous
@Occupato
Anonymous
compiler error when i compile your code
Mat
Where's the error?
Anonymous
Where's the error?
It works just the compiler making a fuse about the input variable
Anonymous
Warning: statement will never be executed
Mat
I saw it, and it isn't an error
Mat
Well, on https://www.onlinegdb.com/online_c_compiler it works
Anonymous
I use Gcc
Mat
And without that line you don't declare input. It's a strange warning
Anonymous
What does the .2 do
Anonymous
In the format specifier
Mat
What does the .2 do
It limits the output to the first 2 digits after the .
Anonymous
o i see, it rounds it up
Anonymous
well i learnt alot from you matt , thanks @Occupato
Anonymous
now time for chapter 4,
Anonymous
arduino programming with C will be next week
Shanks
Anonymous
Герхард
no comments.. when things are obvious
Anonymous
And without that line you don't declare input. It's a strange warning
The statements written above the cases in switch case are never executed. That's why the warning.
Anonymous
Mmm, the warning talks about the = 0; part, right
The warning is just that line 15 float input =0; will never be executed, ie declaration as well as assignment.
Mat
So it will not be declared
Mat
I think it is, as the cases don't return an error
Khaleed
Hy
Khaleed
/
Dima
Welcome!
Khaleed
Thanks
Ajay
Hai
Anonymous
Can i get c video
Anonymous
For beginners
Anonymous
What is int (*a[10])(int) ?
Anonymous
Anonymous
What is int (*a[10])(int) ?
An array of 10 pointers to functions that have one int parameter and return int
Anonymous
Anonymous
Selection sort
Anonymous
Hey
Anonymous
Harvey
Hi
Muhammad
Hello Everybody I am beginner of learning c programming
Muhammad
That is why Who can suggest books or video lessons
Anonymous
An array of 10 pointers to functions that have one int parameter and return int
10 pointers to a function? So, all of them point to the same function?
Anonymous
cdecl.org
So, Is there any rule in cpp for reading them.
Anonymous
Snail rule, I gave a link
I gives the right way to read but it doesn't tell the rule
itsmanjeet
😂😂 ok sry