C Programming Programming Rules for this class: 1 - At the beginning of the file the program must be documented see program example below 2 - All global variables must declared and initialized at the beginning of the program after the #includes and #defines. 3 - The main function must be the last function in the program. 4 - All other functions must be between the global variables and the main function 5 - The main function is for creating and initiallizing variables, calling functions, and terminating the program 6 - The functions begin in column 0 7 - The first { must be located in column 0 8 - The corresponding } must be located in column 0 9 - All pair of { } must be aligned in the same column 10 - All paragraphs must be 4 (four) spaces indented 11 - Use camelCasing to name variables and functions 12 - Documment your program as much as possible 13 - Leave two spaces between each function Program example: /********************************************************************* Author : Your Name Course : Course Name and Times Professor : Michael Robinson Program : Program Name and Number Purpose : A brief description of the program Due Date : mm/dd/yyyy Certification: I hereby certify that this work is my own and none of it is the work of any other person. ..........{ your signature }.......... *********************************************************************/ #include #define PROGRAMS 1024 float gpa = 4.00; int credits = 3; char className[20] = "Programming in C"; void indentationSample() //creatiing and loading a 2 dim array of ints { //to show indentation int x = 0; int y = 0; int theArray[10][10]; int row5 = 0; int column5 = 0; for(x=0; x<10; x++) { for(y=0; y<10; y++) { theArray[x][y] = (x+y); printf( "[%2d] ", theArray[x][y] ); if( x == 5 ) { row5 += theArray[x][y]; } else if( y == 5 ) { column5 += theArray[x][y]; } } printf("\n"); } printf( "\n Total of row 5 = %d\n Total of column 5 = %d\n", row5, column5 ); } void printTheData( float gpa, int credits, char className[20], char myName[20], char myMajor[10] ) { //printing all the data received, one field per line/row printf( "My name is %s \n", myName ); printf( "My major is %s \n", myMajor ); printf( "My gpa is %.2f \n", gpa ); printf( "My current class is %d credits\n", credits ); printf( "its name is %s \n", className ); printf( "With %d programs\n\n", PROGRAMS ); //printing all data received, in one line/row printf( "My gpa is %.2f My current class is %d credits and its name is %s My name is %s and my major is %s with %d programs\n\n", gpa, credits, className, myName, myMajor, PROGRAMS ); } int main() { char myName[20] = "Joe Smith"; //creating a char array char myMajor[10] = "CS/IT"; //creating a char array //calling a function passing 5 variables by value printTheData( gpa, credits, className, myName, myMajor ); //calling a function indentationSample(); }