Write a switch-case statement

Assignment Help C/C++ Programming
Reference no: EM13700785

Question: 1 Type 'help switch' and read about switch? case statements.

Question: 2 Create a script named 'descent.m'. Give a brief but concrete example when switch?case statements should be preferred to if? elseif statements. Use block comments to enter your answer in the script.

Question: 3 Your script should contain code that solves the subsequent problem: A user hard codes two variables, N and C (both positive integers). Write a switch?case statement where C is the switch?expression.

If C = 1: you should display all the ODD values starting at N going down to 1 (use "for loop").

If C = 2: you should display all the ODD values starting at N going down to 1 (use "while loop").

If C = 3: you should display all the EVEN values starting at N going down to 1, but skip the number 8 (use "for loop").

If C > 3, you should display an error message of your choice.

Please keep it simple and short and no copy and paste or at least help me get started?

Reference no: EM13700785

Questions Cloud

Identify the modality of the relationship : You are working on the database design that will support PPI's new order entry system. PPI has many thousands of customers around the world who place and pay for orders. One customer can place an order for many products at a time.
Describe the long-term impact new business architecture : You have been asked by the CEO to describe the long-term impact new business architecture for your POS system will have on the organization.
The turbulence reynold number of a stoichometric : Question- The turbulence Reynold number of a stoichometric n-hexane/air mixture, whose mixing time os 50 microseconds and whose large eddies have a mean size of 1 mm, exceeds 10^4 at 1000 K.
Calculate the number of grams of carbon required to react : Question- Calculate the number of grams of carbon required to react completely with 5.5 grams of iron(lll) oxide according to
Write a switch-case statement : Create a script named 'descent.m'. Give a brief but concrete example when switch?case statements should be preferred to if? elseif statements. Use block comments to enter your answer in the script.
An estimation of the laminar flame speed of an alkane : Question- An estimation of the laminar flame speed of an alkane, based on a simple energy balance, gives the correct order-of-magnitude of 10^0 m/s.
How many moles of sbcl5 and sbcl3 : Question- Starting with 0.290mol SbCl3 and 0.170mol Cl2, how many moles of SbCl5, SbCl3, and Cl2 are present when equilibrium is established at 248?C in a 2.50?L flask?
Covert the subsequent decimal numbers into binary numbers : Write the results of the two numbers (in decimal) after the BIT operations and please covert the subsequent decimal numbers into binary numbers:  (using 2 bytes = 16 bits)
Calculate the heat needed to raise the temperature : Question- The specific heat of aluminum is 0.900J/g degrees C. Calculate the heat needed to raise the temperature of a 45.0 g block of aluminum from 20.5 degrees C to 297.4 degrees C

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Composite data types (arrays & records)

Composite data types (arrays & records) can be a problem when they are passed as parameters or returned by functions. Why?

  Search for the value needle in the array

Search for the value needle in the array range given by [hay_begin ... hay_end), using the Linear Search algorithm. This function will return a pointer to the needle value if it is found, or a null pointer if needle is not found.

  Bare in mind this is a program

Bare in mind this is a program with the audience being lawncare and landscaping people. So the events will generally be to know how often a client wants their lawn mowed.

  Question 1the figure given is an example of select onea

question 1the figure given is an example of select onea. class adapter pattern b. observer pattern c. composite

  Write a program that sorts a linked list

Write a program that sorts a linked list of integers using merge sort. the program will read the integers froma file onto a linked list and then sort the linked list using MERGE SORT. this will require additional linked lists but you should use li..

  Deal two cards at a time

Deal two cards at a time, print them out.- Check if they are identical, have just the same rank or just same suit or are completely.different. Print out a message indicating the result of your comparison.

  Modify the program to detect and report

Syntax errors including mismatched parentheses, invalid operator, missing comma, semicolon or assignment operator should be reported as a syntax error and the program should proceed to the next expression.

  Accept positive and negative numbers in its input sequence

the program must accept positive and negative numbers in its input sequence, and ?nd the largest and smallestof the numbers entered whether they are all positive, all negative, or a combination of both positive and negative.

  Develop and implement an interactive two-player yahtzee game

Eliminate redundancy within a program by applying loops and functions - Create structure charts for a given problem and determine an appropriate functional decomposition or top-down design from a structure chart

  Modify the catch block in method2

Modify the catch block in Method2 that catches the TestException so that it displays the original cause of the exception. Compile and run the application to make sure it works.

  Write a program that find the average time spent programming

Write a program that finds the average time spent programming by a student each day over a 3 day period.

  Write a program that will read in 2 test score.

Write a program that will read in 2 test score. The instructor has decided to give each student 10 bonus point on each test. Print out each test score and the total after the bonus, the print the total number of points earned on the tests.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd