Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <ctype.h>
- #include <stdlib.h>
- #include <string.h>
- typedef struct car{
- int miles;
- char make[20];
- char model [20];
- int year;
- float price;
- }CAR;
- void addOne (CAR*);
- int main (void)
- {
- CAR special;
- addOne(&special);
- printf("MILES: %d\n", special.miles);
- printf("MAKE: %s\n", special.make);
- printf("MODEL: %s\n", special.model);
- printf("YEAR: %d\n", special.year);
- printf("PRICE: %.2f\n", special.price);
- //printf("%s\n", special.make);
- system("pause");
- return 0;
- }
- /*===================================================
- This function
- Pre:
- Post:
- */
- void addOne(CAR* spe)
- {
- printf("Enter miles:\n ");
- scanf("%d", &spe->miles);
- printf("Miles: %d\t\n", (*spe).miles);
- printf("Enter make: \n");
- scanf("%s", &spe->make);
- printf("Make: %s\t\n", (*spe).make);
- printf("Enter model: \n");
- scanf("%s", &spe->model);
- printf("Model: %s\t\n", (*spe).model);
- printf("Enter year: \n");
- scanf("%d", &spe->year);
- printf("Year: %d\t\n", (*spe).year);
- printf("Enter price: \n");
- scanf("%f", &spe->price);
- printf("Price: %.2f\t\n\n", (*spe).price);
- return;
- }
Add Comment
Please, Sign In to add comment