[SOLVED] Lab 1 Course: CSE 165

30.00 $

Category: Tags: , , , , ,
Click Category Button to View Your Next Assignment | Homework

You will receive the following solution file(s) instantly after successful payment:

zip file icon Lab-7-haeoem.zip (139.2 KB)
Assignment Instructions Updated Recently? Submit Below and we will provide new Solution!
Submit New Instructions
šŸ”’ Securely Powered by:
Secure Checkout
5/5 - (1 vote)

All the exercises below are selected from the textbook: Thinking in C++ (volume 1).

1. [Exercise-2 on Page 120] Using Stream2.cpp and Numconv.cpp as guidelines, create a program that asks for theĀ  radius of a circle and prints the area of that circle. You can just use the ā€˜*’ operator to square the radius. Do not tryĀ  to print out the value as octal or hex (these only work with integral types). [25 points]

2. [Exercise-1 on Page 226] Create a header file (with an extension of ā€˜.h’). In this file, declare a group of functionsĀ  by varying the argument lists and return values from among the following: void, char, int, and float. Now createĀ  a .cpp file that includes your header file and creates definitions for all of these functions. Each definition shouldĀ  simply print out the function name, argument list, and return type so you know it’s been called. Create a second .cppĀ  file that includes your header file and defines int main( ), containing calls to all of your functions. Compile and runĀ  your program. [35 points]

3. [Exercise-3 on Page 227] Write a program that uses a while loop to read words from standard input (cin) into aĀ  string. This is an ā€œinfiniteā€ while loop, which you break out of (and exit the program) using a break statement. ForĀ  each word that is read, evaluate it by first using a sequence of if statements to ā€œmapā€ an integral value to the word,Ā  and then use a switch statement that uses that integral value as its selector (this sequence of events is not meant toĀ  beĀ  goodĀ  programmingĀ  style;Ā  it’sĀ  justĀ  supposedĀ  toĀ  giveĀ  youĀ  exerciseĀ  withĀ  controlĀ  flow).Ā  InsideĀ  eachĀ  case, printĀ  something meaningful. You must decide what the ā€œinterestingā€ words are and what the meaning is. You must alsoĀ  decideĀ  whatĀ  wordĀ  will signal theĀ  endĀ  ofĀ  theĀ  program.Ā  TestĀ  theĀ  programĀ  byĀ  redirectingĀ  aĀ  fileĀ  intoĀ  theĀ  program’sĀ  standard input (if you want to save typing, this file can be your program’s source file). [40 points]

Requirements:

* Usage of spaces, blank lines, indention, and comments for readability

* Descriptive names of variables, functions, structs, classes, and objects (if any)

* Appropriate usage of structs, classes, and objects (if any)

Penalties:

* Zero if you have possession of a copy of online solutions or work done by someone else.

* 5-point deduction per day late

 

  • Lab-7-haeoem.zip