#include /* * Example from Sep 19, 2013 * Yes * a comment * */ #define FAHRFREEZE 32 #define CELCFREEZE 0 #define MAXVALS 10 #define MAX 20 //int z = 8; //A global variable will get a 0 on your lab in Dr T's class //int howdyfunc(int, int); int main(void) { int celsius_temp = 0, d, e, fahrenheit_temp= 42, c=0, f= 42, x, i, j, k; int scorelist[7] = {90,87,88,79}; float classavgs[20]= {0}; char nameclass[ ]= {'C',' ','c','l','a','s','s','\0'}; char nameclass2[ ]="C 1320"; char notstring[ ] = {'f','o','o','t'}; double stockprice[6]={0}; char stocktype[6]={'X','A'}; char sti; for(i = 0; i < 8; i++) { // printf("scorelist[%d] = %d\t classavg[%d] is %f\t",i, scorelist[i],i,classavgs[i]); printf("nameclass letter is %c\t",nameclass[i]); printf("nc2 letter is %c\t",nameclass2[i]); printf("nstr letter is %c\n",notstring[i]); } printf("nameclass is %s\n", nameclass); printf("nameclass2 is %s\n", nameclass2); printf("notstring is %s\n", notstring); notstring[3]='\0'; printf("notstring is %s\n", notstring); /* for (i=0; i<5; i++) { printf("\nPlease enter a floating point number representing a price for location %d: ",i); scanf("%f", &classavgs[i]); } */ printf("\nPlease select the category you would like to give prices for. The categories are: "); i=0; while (stocktype[i] != 0) { printf("\n%c", stocktype[i]); i++; } // getchar(); scanf("%c",&sti); printf("\nYou entered %c",sti); if (sti == 'A') { printf("\nPlease enter a price for annuals: "); scanf("%f", &stockprice[3]); } else if (sti == 'N') { printf("\nPlease enter a price for native shrubs: "); scanf("%f", &stockprice[4]); } else if (sti == 'X') { printf("\nPlease enter a price for xeric perennials: "); scanf("%f", &stockprice[5]); } for(i = 0; i < 8; i++) { printf("classavgs[%d] is %f\n",i,classavgs[i]); } // printf("Value of variable c is %d, d is %d, e is %d, f is %d max values are %d \n",c,d,e,f, MAXVALS); // // Arrays in C // printf("\nPlease enter two integer values seperated by a space: "); //scanf("%d %d", &d, &e); f = d + c * e; //printf("\n c before curly braces %d",c); c = 0; /* while (c >= 0) { x = (c<=9) + 3; printf("\n x and c in curly braces %d %d\n",x, c); printf("To continue, enter 1. To stop enter -1"); scanf("%d",&c); getchar(); } */ // printf("\n x and c after curly braces %d %d\n",x, c); // int i = 0, j, k = 9; /* for (i = 0; i <= MAX ;i=k ) { k = k+i; j = k*k; printf("\nk is %d and j = %d and i = %d\n",k,j,i); } */ //printf("You entered d= %d and e= %d. d+c*e where c= %d is %d\n",d,e,c,f); d = d * c + e; //printf("You entered e= %d. d*c+e where c= %d is %d\n",e,c,d); d *= c + e; //printf("You entered e= %d. d*c+e where c= %d is %d\n",e,c,d); e +=10; c -= 9; f = d + c * e; //printf("You entered d= %d and e= %d. d+c*e where c= %d is %d\n",d,e,c,f); c = howdyfunc(e, d); //printf("\nHello world %d\n Print a quote \" \n", howdyfunc(e,d) ); quizfunc(c, f); return 0; } int howdyfunc(int a, int b) { int c = -543; //printf("Howdy!! \n"); quizfunc(b, c); return a; } /* Pop Quiz #1 August 29, 2013 Write a function that takes in two integers and declares one integer local variable and then prints all three values and returns 0. */ int quizfunc(int j, int k) { int l = 100; //printf("THe three values are %d %d %d\n ",j, k, l); //quizfunc(, ); return 0; }