C语言getchar问题

#include <stdio.h>
#define SIZE 40 // assume that not more than 40 literals in the input

int main(){

int f=10;
float c;
int value;
int sum;
float resu[SIZE];

int y;
int i;
int isPoint=0;

int value2;

c = getchar();
while ( c != EOF){

  if(c='.'){
      isPoint=1;

}
if(isPoint!=1){
      if(c>='0'&& c <9){
    value=(c-'0');
} 
}

if (isPoint==1){
if(c>='0'&& c <9){
value2= value2* 10+(c-'0');
f=f*10;
sum=sum+value2;}
}

if (c ==' ' || c == '\n')     {
    resu[y]=value +(float)sum/f;
    y++;
    f=10;
    sum=0;
  value=0;
    isPoint=0;
}

 


c = getchar();

}

printf("-\n");

for(i=0; i<y;i++)
printf("%.4f\t%.4f\n", resu[i],resu[i] *2);

return 0;

}
我想把输入的浮点数变为输入值的两倍, 可是运行时无法输出 这是什么原因呀

img

你的代码问题有点多的,下面这个应该可以实现你的想法

#include <stdio.h>
#pragma warning(disable:4996)
#define SIZE 40 // assume that not more than 40 literals in the input

int main() {
    float res[SIZE] = { 0 };
    int i = 0, j = 0;
    char tmp = 0;

    while (scanf("%f", &res[i++]))
    {
        tmp = getchar();
        if (tmp == '\n')
            break;
    }

    for (j = 0; j < i; j++)
    {
        printf("%.4f %.4f\n", res[j], res[j] * 2);
    }
    return 0;

}

img

if(c='.'){