Hey everyone, i'm creating a program that requires the gas gadge to be updated everytime the speed changes. At the moment i'm manually entering the numbers, but later I will have the numbers being entered via txt file. Anyway, i'm having troubles getting the gas gadge to work, here is the code so far:
The main problem is that the inputed number isn't being converted into a percentage, and I have no idea why. I know this might seem like a n00b question, but I can't see the problem.Code:/*Variables*/
// FILE *numList; //list of integers, manually enter numbers for now
int i; //for loop variable;
int temp; //temp number
float num; //speed in %
// numList = fopen("c:\\numList.txt","r");
/*do loop*/
// do{
/*Prompt to enter number*/
printf("Please enter the integer: ");
scanf("%d", &temp);
num = temp /64 * 100;
printf("%.2f\n\n", num);
num = 50;
printf("\t|");
for(i=0;i>=num;i++)
{
printf("-");
}
printf("|");
// }while(num != -1); /*exit do on '-1'*/
getch();
I want the gadge to loop something like the:
|------------------------ |
or something like that, the dashes will represent the speed. Also, If anyone has any other suggestions about how the gadge show look, I'm all ears.
Thanks;
S0n1C!