C Programming Assignment

In: Computers and Technology

Submitted By Damiva
Words 358
Pages 2
C Programming assignment
1/10 APS106 2012 Project An adapted version of Chain Reaction The objectives of this project are twofold: (i) to strengthen your programming skills, and (ii) to provide you an opportunity to develop a complex project as a team. You are required to implement material covered in the APS106 course in a large C program that fulfills the requirements described below. Students will work together in teams, and students (even on different teams) are encouraged to learn from one another. However, each team is expected to develop its own project, and no teams should share code. The evaluation process at the end of term will include an automated and sophisticated comparison of codes that will identify instances of similarity. Such instances will be examined closely. Violations of the above rules will be dealt with in accordance with the University of Toronto’s Code of Behavior on Academic Matters. In case of ambiguities or errors in these instructions, we (the APS106 instructors) may clarify/modify them as the term progresses. IMPORTANT DATES ? March 5 -team registration ? April 9-11 -contest (optional) ? April 13 at 3:00 -submission deadline (report and code) PROJECT COORDINATOR: Babak Samareh (aps106ta@mie.utoronto.ca) -make sure you begin the subject line with “APS106”, as he’s going to get a lot of email. LOGISTICS Students will work in teams of 3-4 people. No exceptions. Teams may be composed of students from any of the five lecture sections of the course. Lists of team members (names and student numbers) must be submitted via email to project coordinator Babak Samareh by the end of the day, March 5. If you cannot find others with whom to work, or if two of you are looking for a third and/or a fourth member, you have two options: (i) send an email to Babak; he’ll connect you with others who are looking for group members (ii) and/or post a note on…...

Similar Documents

The C Programming Language

...The C programming Language The C programming Language By Brian W. Kernighan and Dennis M. Ritchie. Published by Prentice−Hall in 1988 ISBN 0−13−110362−8 (paperback) ISBN 0−13−110370−9 Contents • Preface • Preface to the first edition • Introduction 1. Chapter 1: A Tutorial Introduction 1. Getting Started 2. Variables and Arithmetic Expressions 3. The for statement 4. Symbolic Constants 5. Character Input and Output 1. File Copying 2. Character Counting 3. Line Counting 4. Word Counting 6. Arrays 7. Functions 8. Arguments − Call by Value 9. Character Arrays 10. External Variables and Scope 2. Chapter 2: Types, Operators and Expressions 1. Variable Names 2. Data Types and Sizes 3. Constants 4. Declarations 5. Arithmetic Operators 6. Relational and Logical Operators 7. Type Conversions 8. Increment and Decrement Operators 9. Bitwise Operators 10. Assignment Operators and Expressions 11. Conditional Expressions 12. Precedence and Order of Evaluation 3. Chapter 3: Control Flow 1. Statements and Blocks 2. If−Else The C programming Language 1 The C programming Language 3. Else−If 4. Switch 5. Loops − While and For 6. Loops − Do−While 7. Break and Continue 8. Goto and labels 4. Chapter 4: Functions and Program Structure 1. Basics of Functions 2. Functions Returning Non−integers 3. External Variables 4. Scope Rules 5. Header Files 6. Static Variables 7. Register Variables 8. Block Structure 9. Initialization 10. Recursion 11. The C Preprocessor 1. File Inclusion 2. Macro......

Words: 89362 - Pages: 358

C++ Programming

... C++ PROGRAMMING: FROM PROBLEM ANALYSIS TO PROGRAM DESIGN FIFTH EDITION D.S. MALIK Australia  Brazil  Japan  Korea  Mexico  Singapore  Spain  United Kingdom  United States C++ Programming: From Problem Analysis to Program Design, Fifth Edition D.S. Malik Executive Editor: Marie Lee Acquisitions Editor: Amy Jollymore Senior Product Manager: Alyssa Pratt Editorial Assistant: Zina Kresin Content Project Manager: Matthew Hutchinson Art Director: Faith Brosnan Print Buyer: Julio Esperas Cover Designer: Roycroft Design/ www.roycroftdesign.com Cover Photo: ª Guntmar Fritz/Masterfile Proofreader: Green Pen QA Indexer: Elizabeth Cunningham Compositor: Integra ª 2011 Course Technology, Cengage Learning ALL RIGHTS RESERVED. No part of this work covered by the copyright herein may be reproduced, transmitted, stored or used in any form or by any means graphic, electronic, or mechanical, including but not limited to photocopying, recording, scanning, digitizing, taping, Web distribution, information networks, or information storage and retrieval systems, except as permitted under Section 107 or 108 of the 1976 United States Copyright Act, without the prior written permission of the publisher. For product information and technology assistance, contact us at Cengage Learning Customer & Sales Support, 1-800-354-9706 For permission to use material from this text or product, submit all requests online at www.cengage.com/permissions Further permissions questions can......

Words: 11776 - Pages: 48

C Programming Book

....................................................................................................... 39 2.5 Arithmetic Operators...................................................................................................... 40 2.6 Relational and Logical Operators................................................................................... 40 2.7 Type Conversions........................................................................................................... 41 2.8 Increment and Decrement Operators.............................................................................. 44 2.9 Bitwise Operators ........................................................................................................... 46 2.10 Assignment Operators and Expressions....................................................................... 47 2.11 Conditional Expressions............................................................................................... 49 2.12 Precedence and Order of Evaluation............................................................................ 49 Chapter 3 - Control Flow ......................................................................................................... 52 3.1 Statements and Blocks ................................................................................................... 52 3.2 If-Else ..............................................................................................................................

Words: 60535 - Pages: 243

Quick Reference to C Programming

...A Quick Reference to C Programming Language Structure of a C Program #include(stdio.h) /* include IO library */ #include... /* include other files */ #define.. /* define constants */ /* Declare global variables*/) (variable type)(variable list); /* Define program functions */ (type returned)(function name)(parameter list) (declaration of parameter types) { (declaration of local variables); (body of function code); } /* Define main function*/ main ((optional argc and argv arguments)) (optional declaration parameters) { (declaration of local variables); (body of main function code); } Comments Format: /*(body of comment) */ Example: /*This is a comment in C*/ Constant Declarations Format: #define(constant name)(constant value) Example: #define MAXIMUM 1000 Type Definitions Format: typedef(datatype)(symbolic name); Example: typedef int KILOGRAMS; Variables Declarations: Format: (variable type)(name 1)(name 2),...; Example: int firstnum, secondnum; char alpha; int firstarray[10]; int doublearray[2][5]; char firststring[1O]; Initializing: Format: (variable type)(name)=(value); Example: int firstnum=5; Assignments: Format: (name)=(value); Example: firstnum=5; Alpha='a'; Unions Declarations: Format: union(tag) {(type)(member name); (type)(member name); ... }(variable name); Example: union demotagname {int a; float b; }demovarname; Assignment: Format: (tag).(member......

Words: 253 - Pages: 2

C++ Programming

...C++ CIS328 Professor Vijayakumar Kumarasamy 06/18/2014 Classes Classes are an expanded concept of data structures: like data structures, they can contain data members, but they can also contain functions as members. Object An object is an instantiation of a class. In terms of variables, a class would be the type, and an object would be the variable. Abstraction Data abstraction refers to, providing only essential information to the outside world and hiding their background details, i.e., to represent the needed information in program without presenting the details. Data abstraction is a programming (and design) technique that relies on the separation of interface and implementation. Encapsulation Encapsulation is an Object Oriented Programming concept that binds together the data and functions that manipulate the data, and that keeps both safe from outside interference and misuse. Data encapsulation led to the important OOP concept of data hiding. Data encapsulation is a mechanism of bundling the data, and the functions that use them and data abstraction is a mechanism of exposing only the interfaces and hiding the implementation details from the user. Inheritance One of the most important concepts in object-oriented programming is that of inheritance. Inheritance allows us to define a class in terms of another class, which makes it easier to create and maintain an application. This also provides an opportunity to reuse the code functionality and fast......

Words: 1199 - Pages: 5

C Programming on Linux

...C Programming on Linux What You Need for This Project * A Kali Linux virtual machine. You could use other operating systems too, if they have a C compiler. Writing the hello.c Source Code In a Terminal window, execute this command: nano hello.c The nano editor opens. Type in the program shown below. #include <stdio.h> main() { printf("Hello World!\n"); } Save your file with Ctrl+X, Y, Enter. Compiling hello.c to Create the hello File In a Terminal window, execute these commands: gcc hello.c -o hello ./hello These commands compile the hello.c program, creating an executable machine language file named hello, and run the hello executable. You should see "Hello World!", as shown below. This program works, but it would be nicer if it greeted you by name, and if it put a couple of newline characters after the greeting to make it cleaner-looking. The next version, hello2, will add these features. Writing the hello2.c Source Code In a Terminal window, execute this command: nano hello2.c The nano editor opens. Type in the program shown below. #include <stdio.h> main() { char name[10]; printf("What is your name?"); scanf("%s", name); printf("Hi, %s\n\n", name); } ...

Words: 1293 - Pages: 6

C Programming

...16/15=1.066666667 15%16=10 16%15=1 3a. i = 3 % 4=yes, 3 3b. i = ( 989 – MAX,_ I) / 3=no 3c. i = 4 % 3=yes 3d. x = PI * -1.0 3e. i = 3 / - 4=no 3f. x = 3 / 4= yes, 0.75 3g. x = 3% ( 3 / 4)=no 4a. i = 7 % 3=yes, 1 4b. i = ( 989 - MAX_ I) / 7= no 4c. i = 3 % 7=yes, 3 4d. x = PI * 2.0=no 4e. i = 7/ - 3=no 4f. x = 7 / 3=yes, 2.3333333333 4g. x = 7 % ( 7 / 3)=no p.102 3. What is illegal about the following program fragment? %lf%lf 4. Stylistically, which of the following identifiers would be good choices for names of constant macros? G Part 2 A. Int V Int I Int R V=I*R B. Int Area Int length Int width Area=length*width C. Int Rseries Int R1 Int R2 Int R3 Rseries=R1+R2+R3 D. Int Rparallel Int R1 Int R2 Int R1 Int R2 Rparallel=R1*R2/(R1+R2) Part3 a. 15.0 b. 7.5 c. 5.0,10.0,5,10 d. 15.0 e. 0.51.0 f. 0,3 Part 4 The month day and year are inputed...

Words: 252 - Pages: 2

C Programming

...C PROGRAMMING Section 1. Topics: Functions Statements Input Output Variables Introduction The C programming language has been the most popular high level language used for engineering applications for the last 20 years. It shares many common structures with other procedural languages, such as Pascal, and can be used for general purpose programming of a PC. However, it is also particularly good for development of embedded application programs such as those found in phones, video recorders and so forth. The term procedural language refers to the fact that the language uses procedures to do particular tasks such as printing on the screen. In C these procedures are known as functions and are described below. What is so good about a language like C? The basic reason such languages were developed was to make it easier for humans to program computers. The alternative is the language of the computer, i.e., binary codes. Clearly such ‘low-level’ languages are not very appealing for humans, although sometimes necessary for detailed engineering work. (In fact C is often ‘mixed’ with such languages for engineering applications.) C uses words and symbols that are part of, or similar to, normal language. This makes it easier for programmers to develop code. The C code is converted to the machine code by a special program called a compiler. See note 1. But perhaps the most useful thing about such a language is that it provides the developer with a library of......

Words: 3795 - Pages: 16

Introduction to C Programming

...computer, requiring no translation before being run. 8. Binary: A system of numerical notation to the base 2, in which each place of a number, expressed as 0 or 1, corresponds to a power of 2 9. Main memory: program-addressable storage that is directly controlled by and generally contained in the CPU: except for cache storage, the fastest type of storage available to any computer system. 10. Control systems: is a device, or set of devices, that manages commands, directs or regulates the behavior of other devices or systems. 11. Embedded systems: is a computer system with a dedicated function within a larger mechanical or electrical system, often with real-time computing constraints. 12. Data type: A data type in a programming language is a set of data with values having predefined characteristics. 13. Algorithm: a set of rules for solving a problem in a finite number of steps, as for finding the greatest common divisor. 14. Compiler: a computer program that translates a program written in a high-level language into another language, usually machine language. 15. Interpreter: a program that translates a second program to machine code one statement at a time and causes the execution of the resulting code as soon as the translation is completed 16. Assembly language: a computer language most of whose expressions are symbolic equivalents of the machine-language instructions of a particular computer. 17. File: a folder, cabinet, or other......

Words: 913 - Pages: 4

Cs263 Entire Course Programming in C

...CS263 Entire Course Programming in C http://homeworklance.com/downloads/cs263-entire-course-programming-in-c-2/ CS263 Discussion Module 1 Programming in C Explain the difference between using an algorithm and pseudo code. CS263 Discussion Module 2 Programming in C What are comments? Why comments are included in programs? Are they necessary for an production environment? Explain CS263 Discussion Module 3 Programming in C Why should you not use an external file name in any place other than the open statement? CS263 Discussion Module 4 Programming in C The three basic control structures are sequence, selection, and repetition. Pick one and discuss it. CS263 Discussion Module 5 Programming in C What is a function? State the advantages in using a function. What is the difference between system defined and user defined functions? CS263 Discussion Module 6 Programming in C 1. What is the difference between static and register variables? Give at least one example. CS263 Discussion Module 7 Programming in C How are arrays processed? Explain with an example. CS263 Discussion Module 8 Programming in C 1. What did you find difficult in doing this project? 2. What would you have done differently? CS263 Module 1 Assignment Programming in C Write an algorithm to compute the volume of water in cubic feet, flowing through a pipe of diameter d in feet, with a velocity of v feet per second. The formula to......

Words: 744 - Pages: 3

Cs263 Entire Course Programming in C

...CS263 Entire Course Programming in C http://homeworklance.com/downloads/cs263-entire-course-programming-in-c-2/ CS263 Discussion Module 1 Programming in C Explain the difference between using an algorithm and pseudo code. CS263 Discussion Module 2 Programming in C What are comments? Why comments are included in programs? Are they necessary for an production environment? Explain CS263 Discussion Module 3 Programming in C Why should you not use an external file name in any place other than the open statement? CS263 Discussion Module 4 Programming in C The three basic control structures are sequence, selection, and repetition. Pick one and discuss it. CS263 Discussion Module 5 Programming in C What is a function? State the advantages in using a function. What is the difference between system defined and user defined functions? CS263 Discussion Module 6 Programming in C 1. What is the difference between static and register variables? Give at least one example. CS263 Discussion Module 7 Programming in C How are arrays processed? Explain with an example. CS263 Discussion Module 8 Programming in C 1. What did you find difficult in doing this project? 2. What would you have done differently? CS263 Module 1 Assignment Programming in C Write an algorithm to compute the volume of water in cubic feet, flowing through a pipe of diameter d in feet, with a velocity of v feet per second. The formula to......

Words: 744 - Pages: 3

C Programming

...Welcome to CS 241 Systems Programming at Illinois Robin Kravets Copyright ©: University of Illinois CS 241 Staff 1 The Team  Robin Kravets    TAs   Office: 3114 SC rhk@illinois.edu Wade Fagen, Farhana Ashraf, Hilfi Alkaff and Mainak Ghosh Discussion Sections   8 sessions (Thursdays 9, 10, 11, 12, 1, 2, 3, 4) All sections in SC 0220 Copyright ©: University of Illinois CS 241 Staff 2 News and Email  Announcements and discussions: Piazza  http://www.piazza.com/illinois/cs241     All class questions This is your one-stop help-line! Will get answer < 24 hours e-mail   cs241help-fa12@cs.illinois.edu Personal questions not postable on the news group Copyright ©: University of Illinois CS 241 Staff 3 The Textbook  Introduction to Systems Concepts and Systems Programming      University of Illinois Custom Edition Copyright © 2007 Pearson Custom Publishing ISBN 0-536-48928-9 Taken from:    Operating Systems: Internals and Design Principles, Fifth Edition, by William Stallings UNIX™ Systems Programming: Communication, Concurrency, and Threads, by Kay A. Robbins and Steven Robbins Computer Systems: A Programmer's Perspective, by Randal E. Bryant and David R. O'Hallaron Copyright ©: University of Illinois CS 241 Staff 4 Your CS 241 “Mission”  Come to class     Read textbook    20% 7:00 – 9:00 PM October 15th Final  3% 47% Longer MPs are worth a little more Midterm   Reading assignments posted on......

Words: 1748 - Pages: 7

Cs263 Entire Course Programming in C

...CS263 Entire Course Programming in C http://homeworklance.com/downloads/cs263-entire-course-programming-in-c-2/ CS263 Discussion Module 1 Programming in C Explain the difference between using an algorithm and pseudo code. CS263 Discussion Module 2 Programming in C What are comments? Why comments are included in programs? Are they necessary for an production environment? Explain CS263 Discussion Module 3 Programming in C Why should you not use an external file name in any place other than the open statement? CS263 Discussion Module 4 Programming in C The three basic control structures are sequence, selection, and repetition. Pick one and discuss it. CS263 Discussion Module 5 Programming in C What is a function? State the advantages in using a function. What is the difference between system defined and user defined functions? CS263 Discussion Module 6 Programming in C 1. What is the difference between static and register variables? Give at least one example. CS263 Discussion Module 7 Programming in C How are arrays processed? Explain with an example. CS263 Discussion Module 8 Programming in C 1. What did you find difficult in doing this project? 2. What would you have done differently? CS263 Module 1 Assignment Programming in C Write an algorithm to compute the volume of water in cubic feet, flowing through a pipe of diameter d in feet, with a velocity of v feet per second. The formula to......

Words: 744 - Pages: 3

C# Programming

...True or False (Circle T/F if you think the statement is true/false) (Each question worth 5 points) 1. In C#, a project is a set of files and a solution is a set of projects. T 2. Every object you create or use in C# programming has a specific type usually. When a method doesn’t return anything, there is no return type defined for the method. F 3. In C#, some of the objects, variables or constants don’t have a specific type. F 4. The continue statement skips the remaining statements in the loop (any loop) and transfers control to the test condition. T 5. A smaller type must be explicitly cast to a compatible larger type. F 6. Assume you declared a constant when you’re programming. Although it is called a “constant”, its value can be changed when the program is running. F 7. The members in class A that are marked by private are accessible to methods of class A and also to methods of classes derived from class A. F 8. In C#, when you declare a variable without initializing it, the system will initialize the variable to 0 automatically as VB does. F 9. The system will execute a mathematical formula from left to right; you don’t have to consider the issue of operator precedence in C#. F 10. Implicit casting sometimes runs the risk of data loss. F Multiple Choice questions: (Circle all that applies. If all of your choices are correct but you missed the other correct choices, you will receive......

Words: 390 - Pages: 2

Ledger C Programming

...all records"); printf("\n E - Exit\n"); scanf("%c", &choice); choice=toupper(choice); switch(choice) { case 'A': add();break; case 'L': list();break; case 'D': deleterec();break; case 'E': exit(0); default: system("cls"); } } } void add() { FILE *f; char test; f=fopen("c:/mark.txt","ab+"); if(f==0) { f=fopen("c:/mark.txt","wb+"); system("cls"); } system("cls"); printf("\n Enter phone number:"); scanf("%s",&s.phonenumber); printf("\n Enter name:"); fflush(stdin); scanf("%[^\n]",&s.name); printf("\n Enter amount:"); scanf("%f",&s.amount); fwrite(&s,sizeof(s),1,f); fflush(stdin); system("cls"); printf("1 record successfully added\n"); fclose(f); printf("Hit any key to return"); getchar(); } void list() { FILE *f; int i; if((f=fopen("c:/mark.txt","rb"))==NULL) { system("cls"); printf("No accounts available\n"); } else { system("cls"); printf("Phone Number\t\tUser Name\t\t\tAmount"); while(fread(&s,sizeof(s),1,f)==1) { printf("\n%-10s\t\t%-20s\t\t%.2f ",s.phonenumber,s.name,s.amount); } printf("\n"); fclose(f); } printf("\n"); getchar(); } void deleterec() { FILE *f,*t; system("cls"); printf("Deleted all accounts"); remove("c:/mark.txt"); printf("\n"); getchar(); }...

Words: 280 - Pages: 2

Ruyi's Royal Love ... | 第22集 | Алексей Шевченков