1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
#include <stdio.h>
int main()
{
int i=0;
float floater1[20];
float *floatpointer=floater1;
char line[100];
printf("Please enter up to 20 numbers in one line\n");
scanf("%f", floater1);
fgets(line, sizeof(line), stdin);
sscanf(line, "%f %f", floatpointer, floatpointer+1);
printf("%f %f", floatpointer, floatpointer+1);
}
#include <stdio.h>
int main()
{
int i=0;
float floater1[20];
//float *floatpointer=floater1;
char line[100];
printf("Please enter up to 20 numbers in one line\n");
scanf("%f", floater1);
fgets(line, sizeof(line), stdin);
sscanf(line, "%f %f", floater1[0], floater[1]);
printf("%f %f", floater[0], floater[1]);
}
|