Starting from:

$40

KIT107 Programming Solved

KIT107 Programming                                                                                             Assignment 0

 

This assignment is for formative purposes only but should be submitted so that progress and engagement may be considered.  Please try to complete the tasks below and seek help if you are unable to complete them within a week or two.  Its purpose is to allow you to determine your strengths and weaknesses and to address them.

Program specification
1.     You must write a C program to define two char variables with values 'A' and '$' and to swap their values.

2.     You must write a C program to ask the user to enter two int variables from the keyboard and display all numbers between these.

3.     You must write a C program to define an array of ten non-negative double values — with up to ten values entered by the user (stopping before ten if they enter –1.0) — and then display the sum of all values stored in the array.

 

Program Style
Your program should follow the following coding conventions:

•       const variable identifiers should be used as much as possible, should be written all in upper case and should be declared before all other variables

•       #defined symbols should be used for constant values when const is inappropriate — the length of arrays (for example)

•       variable identifiers should start with a lower case letter

•       every if and if-else statement should have a block of code (i.e. collections of lines surrounded by { and }) for both the if part and the else part (if used)

•       every do, for, and while loop should have a block of code (i.e. {}s)

•       the keyword continue should not be used

•       the keyword break should only be used as part of a switch statement

•       opening and closing braces of a block should be aligned

•       all code within a block should be aligned and indented 1 tab stop (or 4 spaces) from the braces marking this block

•       global variables should be used sparingly with parameter lists used to pass information in and out of any functions.

•       commenting:

o   There should be a block of header comment which includes at least

§  file name

§  student name

§  student identity number

§  a statement of the purpose of the program

§  date o  Each variable declaration should be on a single line and should be commented

1/2

o   There should be a comment identifying groups of statements that do various parts of the task

o   Comments should describe the strategy of the code and should not simply translate the C into English

2/2

More products