I have one problem, and i have no idea what is happening?
THE output gives some strange things:
type of your cpu is:
amd
cpu speed is:
123
enter the year when it's produced
2000
enter the price of your computer
scanf: floating point formats not linked
abnormal program termination
Please, help me on this! thanks.
__________________________
#include <stdio.h>
struct computer
{
float cost;
int year;
int cpu_speed;
char cpu_type[16];
};
typedef struct computer SC;
void DataReceive(SC *ptr_s);
int main()
{
SC model;
DataReceive(&model);
printf("Here are what you've entered\n");
printf("Year is: %d\n", model.year);
printf("Price is: %f\n", model.cost);
printf("Cpu type is: %s\n", model.cpu_type);
printf("Cpu speed is: %d\n", model.cpu_speed);
return 0;
}
void DataReceive(SC *ptr_s)
{
printf("Type of your cpu is:\n");
gets((*ptr_s).cpu_type);
printf("Cpu speed is:\n");
scanf("%d", &(*ptr_s).cpu_speed);
printf("enter the year when it's produced\n");
scanf("%d", &(*ptr_s).year);
printf("Enter the price of your computer\n");
scanf("%f", &(*ptr_s).cost);
}