I am not massively competent at programming, so please comment as much as you feel is appropriate.
I am designing a complex impedance circuit with several components. Basically I want to ask the user if they want to replace a certain component with a different one.
printf("Do you want to replace either capacitor 1, or 2 with a CPE? (y/n)\n");
getchar()?? fgets, strings??
I dont know which to use. I need it to loop somehow, so that if other characters/numbers are entered other than y/n, then it re-asks the question.
I know this is probably annoying simple. But i have scoured the internet, but they seem to use something like while (getchar != '\n'), i dont know why this is needed...does getchar read a return as a \n. I've also read things about using two getchars???
I just want it to work and be reasonably bullet proof.
Thank you ever so much for any help you can offer me.