anyone know what is causing the error in this small program? I'm having a little trouble with Structs.
(copy/paste into compiler)
Thanks
Error:
d11.7.c:36: error: parse error before "part_item"
d11.7.c:37: error: parse error before "part_item"
Program:
---------------------
#include <stdio.h>
#include <string.h>
struct part_item
{
char number[10];
float price;
int qty;
};
void print_inv(stuct part_item );
float find_inv(stuct part_item );
void main(void)
{
struct part_item part;
struct part_item old_item;
part.price = 0.35;
strcpy (part.number, "SMS0001"
part.qty = 20;
printf("What is the part number? "
gets(old_item.number);
printf("The Price? "
scanf("%f", &old_item.price);
printf("And the quantity? "
scanf("%d", &old_item.qty);
print_inv(part);
print_inv(old_item);
}
void print_inv(struct part_item prt)
{
float inventory;
inventory = find_inv(prt);
printf("%s\t%.2f\t%d\t%.2f\n", prt.number, prt.price, prt.qty, inventory+1);
}
float find_inv(struct part_item prt)
{
return (prt.price * prt.qty);
}
(copy/paste into compiler)
Thanks
Error:
d11.7.c:36: error: parse error before "part_item"
d11.7.c:37: error: parse error before "part_item"
Program:
---------------------
#include <stdio.h>
#include <string.h>
struct part_item
{
char number[10];
float price;
int qty;
};
void print_inv(stuct part_item );
float find_inv(stuct part_item );
void main(void)
{
struct part_item part;
struct part_item old_item;
part.price = 0.35;
strcpy (part.number, "SMS0001"
part.qty = 20;
printf("What is the part number? "
gets(old_item.number);
printf("The Price? "
scanf("%f", &old_item.price);
printf("And the quantity? "
scanf("%d", &old_item.qty);
print_inv(part);
print_inv(old_item);
}
void print_inv(struct part_item prt)
{
float inventory;
inventory = find_inv(prt);
printf("%s\t%.2f\t%d\t%.2f\n", prt.number, prt.price, prt.qty, inventory+1);
}
float find_inv(struct part_item prt)
{
return (prt.price * prt.qty);
}