From af641aa215395e9e7d67ac775cd2513d5623ccf9 Mon Sep 17 00:00:00 2001 From: arobbins Date: Mon, 26 Nov 2018 18:48:26 -0800 Subject: [PATCH] add lab12.1.c --- lab12.1.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 lab12.1.c diff --git a/lab12.1.c b/lab12.1.c new file mode 100644 index 0000000..dc11910 --- /dev/null +++ b/lab12.1.c @@ -0,0 +1,28 @@ +#include +#include + +struct dog +{ + int age; + char name [10]; //removed = +}; + + +void main() +{ + struct dog thing1; //changed : to ; + struct dog thing2; + + thing1.age = 5; //removed [] + thing2.age = 13; + + puts("What is your dogs name? "); //changed {} to () + gets(thing1.name); //removed s at end of name(s) + + strcpy(thing2.name, "Buster"); + + printf("Thing1 Name: %s\n",thing1.name ); //changed from %i to %s //smoothed sentence flow + printf("Thing1 Age: %i\n",thing1.age); //smoothed sentence flow + printf("Thing2 Name: %s\n",thing2.name); //added final " between \n and , + printf("Thing2 Age %i\n",thing2.age); //changed ' to " +} \ No newline at end of file