vendredi 30 janvier 2015

Why won't my program print out a character in c?


Vote count:

0




Why won't my program print out a character in c? I can not seem to find any error in this. Below is a snippet of my program. When I tried to print firstBand character out, all i get is nothing.



#include <stdio.h>
#include <stdlib.h>



/*
*
*/

int bandOne;
int bandTwo;
double multiplierValue;
double resistanceValue;
double toleranceValue;
char firstBand;
char secondBand;
char multiplier;
char tolerance;

int main(void) {
//prompt user for band colours
printf("Colour of first band?\n");
firstBand = scanf(" %c",&firstBand);
printf("Colour of second band?\n");
secondBand = scanf(" %c",&secondBand);
printf("What is multiplier?\n");
multiplier = scanf(" %c",&multiplier);
printf("What is the tolerance?\n");
tolerance = scanf(" %c",&tolerance);

printf("%c\n",firstBand);

....
..
..

return 0;

}


please help.



asked 43 secs ago







Why won't my program print out a character in c?

Aucun commentaire:

Enregistrer un commentaire