Assignment 1 consists of THREE (3) exercises: Solved

$24.99 $18.99

Course Assignment/Exercise Notation Conventions: Each weekly “assignment” consists of several “exercises”. Throughout this course I commonly refer to these using an abbreviated notation, where a form like C1A2E3 would refer to exercise 3 in assignment 2 of the “C/C++ Programming I” course and C1A2 would refer to the entirety of assignment 2 of that course.…

5/5 – (2 votes)

You’ll get a: zip file solution

 

Description

5/5 – (2 votes)

Course Assignment/Exercise Notation Conventions: Each weekly “assignment” consists of several

  1. exercises”. Throughout this course I commonly refer to these using an abbreviated notation, where a

  2. form like C1A2E3 would refer to exercise 3 in assignment 2 of the “C/C++ Programming I” course and

  1. C1A2 would refer to the entirety of assignment 2 of that course.

7

  1. Getting Started: Before starting your first assignment you must have the appropriate tools for developing

  1. your software and the best way to get them is to download and install one of the many free integrated

  1. development environment (IDE) packages. These integrate the compiler, editor, and other necessary

  2. tools into a convenient GUI application. Although you are free to use any tools you wish and any

  3. operating system that will support them, I recommend Microsoft’s “Visual Studio Community” for

  4. Windows, “Xcode” for macOS, and “Code::Blocks” for Linux. Information on obtaining, installing, and

  5. using them is available in the appropriate version of the “Using the … IDE” course document, a link to

  6. which is located on the “Assignments” page of the course website. I am sorry but I do not have

  1. information on other IDE’s or operating systems.

17

  1. Source Code Files: Header Files and Implementation Files: “Source code” files contain the code

  1. necessary for a program to be built without errors and are divided into the two categories “header” files

  2. (.h, etc.) and “implementation” files (.c, .cpp, etc.). Not all programs require header files but at least

  3. one implementation file is always required. Header files are designed to be included in other files using

  4. the #include directive but implementation files are not. By placing items that might be needed by

23 multiple other files in header files and including them in those files the bad practice of literally

  1. duplicating the needed items in each file can be avoided. Because of their multiple usages, however,

  2. header files must never contain anything that will result in an error if more than one file includes them.

  3. Files containing data that your program reads or writes are not considered source code files but are

  4. instead “data files”.

28

  1. Although some of the following terminology has not yet been discussed in this course it is placed here

  1. for completeness and for future reference: Header files typically contain things like macro definitions,

  2. inline function definitions, function prototypes, referencing declarations, typedefs, class/structure/union

  3. descriptions, and templates, although any of these that will only ever be needed by one specific

  4. implementation file may be placed in that file instead. Header files must not contain non-inline function

  5. definitions or defining variable declarations; these must be placed in implementation files instead. The

  6. header files that are supplied with a compiler provide the information it needs to properly compile code

  1. that uses the various functions, macros, and data types available in the compiler’s libraries.

37

  1. Exercise Submission Procedure: Get an exercise to work first on your computer, then submit it to the

  1. assignment checker” and wait for the results to be returned. If there are any errors or warnings make

  2. the appropriate corrections and resubmit, repeating as necessary until all issues are corrected.

  3. Additional details are provided in each exercise and the course document titled “How to Prepare and

  1. Submit Assignments”.

Assume language standards compliance and any necessary standard library support unless stated otherwise. These are not trick questions and there is only one correct answer. Basing an answer on actual testing is risky. Place your answers in a plain text “quiz file” named C1A1E0_Quiz.txt formatted as:

a “Non-Code” Title Block, an empty line, then the answers:

  1. A

  2. C etc.

Personalized C1A1 requirements exclusively for Jose Medrano (U09845800)

C/C++ Programming I (Section 174273)

  1. C1A1E1 (7 points – C++ Program)

  1. Exclude any existing source code files that may already be in your IDE project and add a new one,

  2. naming it C1A1E1_main.cpp. Write your program in that file.

4

  1. Note 1.7 of the course book illustrates how some expressions can be written more compactly, where the

  2. most compact form is defined as the form containing the fewest non-whitespace characters. For

7 example, x = x + y should always instead be written as x += y. The most compact form is always the

  1. most appropriate form and is the only form allowed in this course.

  1. Note 2.7 illustrates the most appropriate way to negate (change the sign of) the value of a variable. For

  2. example, unconditionally negating the current value of x should always be written as x = -x, never in

  3. any other way. It is the only form allowed in this course.

13

  1. Write a program that displays the most appropriate form of each of the following 14 expressions with

  2. respect to the updated value of integer variable ax. Do not attempt to actually evaluate the

  3. expressions. Of these expressions:

  1. Two are already in their most appropriate form.

  1. Two have two most appropriate forms.

  2. Four only involve the negation of the value of ax.

20

  1. ax = ax + bx

  1. ax = ax / -bx

  2. ax = bx / ax

  3. ax = -1 * ax

  1. ax = -ax * ax

  2. ax = -bx * ax

  3. ax = bx – ax

  1. ax = 2 + ax

  2. ax = 1 + ax

  3. ax = ax – 37

  1. ax = ax – 1

  2. ax *= -1

  3. ax /= -1

  1. ax = 0 – ax

35

  1. Display each expression on a separate line along with its most appropriate form with double-quotes

  2. around each. Be sure to display the words should be after the original expression and the word or

  3. between the most appropriate forms if there is more than one. Here is an example of the required

  4. output format for three hypothetical expressions:

40

  1. “abc = def – ghi” should be “abc = def – ghi”

  1. “abc = abc * def” should be “abc *= def”

  2. “abc += 1” should be “++abc” or “abc++”

44

  1. The code in your main function must start with cout << or std::cout << on a line by itself.

  2. Do not use cout or the << operator more than once.

  1. Do not declare any variables.

48

49

  1. Submitting your solution

  1. `Send an empty-body email to the assignment checker with the subject line C1A1E1_174273_U09845800

  1. and with your source code file attached.

Personalized C1A1 requirements exclusively for Jose Medrano (U09845800)

C/C++ Programming I (Section 174273)

  1. See the course document titled “How to Prepare and Submit Assignments” for additional exercise

  2. formatting, submission, and assignment checker requirements.

55

56

  1. Hints:

  1. See notes 1.5, 1.7, and 2.7.

  1. Exclude any existing source code files that may already be in your IDE project and add a new one,

  2. naming it C1A1E2_main.c. Write a program in that file to display the exact text below using printf:

4

  1. In C/C++ the case of letters is significant.

  2. main is where program execution begins.

  3. A semicolon terminates most statements.

  4. 10% of “nothing” is 100% of “nothing”.

  5. Use \n to cause a newline; use \t to cause a tab.

  6. Use \a to cause a beep (only in some cases)!

11

  1. Your program must:

  2. 1. not call printf more than once.

  3. 2. not use the underlying numeric value of any character.

  4. 3. not use the %c or %s conversion specifications.

16

17

  1. Submitting your solution

  1. `Send an empty-body email to the assignment checker with the subject line C1A1E2_174273_U09845800

  1. and with your source code file attached.

  1. See the course document titled “How to Prepare and Submit Assignments” for additional exercise

  2. formatting, submission, and assignment checker requirements.

23

24

  1. Hints:

  2. To display a percent character located within a printf control string (the control string is the first

  3. argument of printf) use two percent characters together. To represent a backslash character in any

  4. string use two backslash characters together. The compiler automatically concatenates multiple string

  1. literals separated only by zero or more whitespaces into one string, including string literals on separate

  2. lines.

Assignment 1 consists of THREE (3) exercises: Solved
$24.99 $18.99