From a61a49ca0fa4a8de443d05703623a648b3b10780 Mon Sep 17 00:00:00 2001 From: Haldrup-tech Date: Tue, 3 Sep 2024 14:40:28 -0400 Subject: [PATCH] lab code and lecture code --- csci218/Lect/ex6inClass.c | 40 ++++++++++++++++++++++++++++++++++++ csci218/Lect/ex6inClass.out | Bin 0 -> 33472 bytes 2 files changed, 40 insertions(+) create mode 100644 csci218/Lect/ex6inClass.c create mode 100755 csci218/Lect/ex6inClass.out diff --git a/csci218/Lect/ex6inClass.c b/csci218/Lect/ex6inClass.c new file mode 100644 index 0000000..0351afb --- /dev/null +++ b/csci218/Lect/ex6inClass.c @@ -0,0 +1,40 @@ +/* simple statement example ex6InClass.c +By Dr. Xu +This program is for explaining the building blocks of C +*/ + +# include //For accessing the standard library functions +# include + +int main() { + /* literals: 5, 6, 3, 3.14, "James", '!' + Variables: a, b, c, name, punc + Constant: PI + Expressions: a + b * 3, a + 6 + function: printf() + datatype: int, char, float + */ + + //variable declaration ; + // variable assignment + int a, b; // variable assignment + //variable declaration and initialization + a = 5; + b = a + 5; + float c = 1.5; + + const float PI = 3.1415926; + + c = PI * pow(b, 2.0); + + + printf("a = %d\nb = %d\nc = %.3f\nPI = %.3f\n", a, b, c, PI); + + char stName[] = "James"; + char punc = '!'; + + printf("Good Bye, %s%c\n", stName, punc); + + //printf("Good bye, %s %c \n", name, punc); + return 0; +} diff --git a/csci218/Lect/ex6inClass.out b/csci218/Lect/ex6inClass.out new file mode 100755 index 0000000000000000000000000000000000000000..30f351d4f7ffadfc9123911a74215173e1bf9ab8 GIT binary patch literal 33472 zcmeI5Urbw79LLXX%R&(cGm~hxmCFnYIKc=pBxdZgjsR|shOvYh-C3aps?ZWz95~c& zh>O#QVMtu&3nViuWSV7}Np&nVlI&qGidl4OT-=KR6Q|Mmz!t>c@7xRAg1QHdPv2ki z>+jDw=XcKe+}p=<&u6!P`XgHiO^`T9H;{I_gcuS!c|tr$T1P6Sue!G8*_y@%&ZdhR zoSs?}ah>bbQOc&8=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