| EECS 110: INTRODUCTION TO PROGRAMMING |
Home General Info Help |
Lectures Homework |
This assignment is designed to get you started in programming in C. There are 3 problems, which should be done in order. Each problem solution should be put in a separate C file in a separate project.
If you use Bloodshed's Dev-C++, use these instructions for compiling code.
If you use Microsoft's Visual Studio, use these instructions for compiling code.
In class, my demonstrations will use Dev-C++.
Create a new project for this assignment, e.g., PA1. Add a C file named pa1_1.c (for assignment 1, problem 1) to it. Type the following code into pa1_1.c:
#include<stdio.h> ;
int main () {
printf("Type any letter except Z or z: ")
scanf(" %c", lttr);
printf("You typed %d/n");
char next_letter; next_letter = ltr + 1;
printf("The next letter is %c."); /* print
the next letter
Return 0;
}
This is not working code. It has several kinds of errors. Furthermore, it is not written in a very readable way. Fix the program so that it compiles and runs with no errors. Then make changes to improve the readability of the program. A sample execution should go like this:
Type any letter except Z or z: g You typed g. The next letter is h.
Create a new project and add a C file named pa1_2.c (for assignment 1, problem 2) to it. Write code in pa1_2.c that does the following:
The formula for converting degrees Fahrenheit to degrees Celsius is C = (F - 32) . 5.0/9.0.
Things to think about:
Create a new project and add a C file named pa1_3.c (for assignment 1, problem 2) to it. Write code in pa1_3.c that does the following:
For example, if the customer says they have 37 pennies, then the program should say that this is equivalent to one quarter, one dime and two pennies. A sample execution of your program could look like this:
Welcome to ACE, the Automatic Coin Exchange machine. Enter number of pennies: 37 Thank you. Your pennies are worth 1 quarter(s) 1 dime(s) 0 nickel(s) 2 pennies
Hints and tips: