Use a define statement to create a constant

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

Write a program in C to print your first and last name, ID number, and the mark you hope to get in this course (make one up, it doesn't have to be what you really hope for and it WILL NOT have any influence on your actual mark).

Follow these specifications: Use a define statement to create a constant that will hold your student number. You should have separate string variables for your first and last name; name these first_name and last_name. We will use integer marks, so name the mark you hope for "hope_mark" and the difference between that and 100 "difference".


?Start by asking "Please enter your first name" and then accept the first name into first_name. Do the same for last_name. Next, calculate the number of characters in first and last name and print out "There are xx characters in your first name and xx characters in your last name" replacing xx with the correct numbers. You will now create a list of hope_marks entered along with their difference from 100. We will use a loop, but first tell the user "Enter the mark you hope to get and I'll tell you how far you are from 100 - enter 100 to quit." Print the headings for "Hope Mark" and "Marks from 100" in fields 15 characters wide.


Next, use a while loop to ask for and input a hope_mark. Tell the user to enter a mark between 0 and 100. (For this assignment you do not need to check that the hope_mark is between 0 and 100, although normally you would.) Calculate the difference of the hope_mark from 100. Then print the hope_mark right-aligned in a field 15 characters wide, and the difference left-aligned in a field 15 characters wide. (Do not worry if your compiler gives you a warning about implicit conversion)


If you have done all this correctly, you will notice that the two marks you print run together into what looks like a single number. Figure out how to insert a single space between them WITHOUT changing the field width from 15 characters. If the user enters 100, exit the loop and print "Wow, I hope you DO get perfect!" and end the program by calling the copyright_me() function that you created for assignment 1.??

Use ANSI C comments to show your name and ID number as the first line of the program, as well as the text "Assignment #2." After that, include your answer to Question 1 in the same comment block.


ou should only test hope_mark with numbers from 0 to 100. You should treat any number greater than 99 as 100 for purposes of controlling the loop but for this assignment don't worry about how it affects the variable difference (i.e. calculate difference as if the input were always between 0 and 100). You do not need to verify the input. You will also get odd results if you enter a negative hope_mark, but for this question we will ignore that problem and treat the input as if it was 0 ? 100.

Reference no: EM13161701

Questions Cloud

Create a c++ console application : Objective: Create a C++ console application that will model the characteristics of a resistor. Create a multifile project. Create and add to the project an h file containing the resistor-class definition. Create and add to the project a cpp file cont..
Set of strings of balanced parentheses : Show that the set of strings of balanced parentheses is not defined by any regular expression. Hint: The proof is similar to the proof for the language E above. Suppose that the set of balanced strings had a deterministic finite automaton of m states
Application named arithmeticmethods : Create an application named ArithmeticMethods whose main() method holds two integer variables. Assign values to the variables. In turn, pass each value to methods named displayNumberPlus10()
Analyze the potential readability : Analyze the potential readability problems with using closure reserved words for control statements that are the reverse of the corresponding initial reserved words
Use a define statement to create a constant : Follow these specifications: Use a define statement to create a constant that will hold your student number. You should have separate string variables for your first and last name; name these first_name and last_name.
Perform the acyclic-topological sort algorithm : Perform the acyclic-topological sort algorithm on the directed graph having vertex set a-k and edges {(j; a);(j; g);(a; b);(a; e);(b; c);(c; k);(d; e);(e; c);(e; f);(e; i);(f; k); (g; d);(g; e);(g; h);(h; e);(h; i);(i; f);(i; k)} Show the state of th..
Prove by solving the equations using laplace transform : For a RC circuit, we can use Laplace transforms to show that when we apply a step input of 5V, the voltage across the capacitor rises exponentially to a final value equal to step input.
Travelling salesman problem involves : The Travelling Salesman problem involves a salesman who has to visit a number of cities in a single closed tour. The salesman always starts and ends the tour in his home city and visits each other city on the tour exactly once.
Determine the number of bonding electrons : Determine the number of bonding electrons and the number of nonbonding electrons in the structure of BeF_2 please Enter the number of bonding electrons followed by the number of nonbonding electrons

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Program to store lists of names and ages in parallel arrays

Write a C++ program that stores lists of names (the last name first) and ages in parallel arrays and sorts the names into alphabetical order keeping the ages with the correct names.

  Multiple heaps

Create an application that has two heaps. Place a linked list into each heap. Select one hundred random numbers. Place each of the random numbers into each heap - CSI 345 - Spring 2014 S2

  Calculate that implements a simple arithmetic calculator

Write a  C program  calc.c that implements a simple arithmetic calculator. Input to the calculator consists of lines composed of integer constants separated by the five arithmetic operators used in C: +, -, *, /, and %. For each line of input,

  Recognition of the problem by the hsbc

What problem did the HSBC face in this case? What people, technology, and the organization factors were responsible for problem? Did HSBC management correctly recognize the problem?

  Implement circular linked list in c program

implement circular linked list in c program in the best possible easiest way.

  How a base version of this assignment works

For this assignment you are to create an interactive moving sign in the context of a cityscape street scene. Click the link below to see how a base version of this assignment works. Type a message in the long blank slot at the top left, and then clic..

  What constructors do and when they are executed

Explain what constructors do and when they are executed. Explain the two types of constructors. Provide an example class that includes both types of constructor functions and demonstrate how an object would be instantiated using both types of constru..

  Write program using c language to find page fault

Write program using c language to find page fault for individual processes, group of processes and system as whole using following system call int sys_pgfltstats(pid_t pid,int flag,pf_info_struct *info).

  Create a program that maintains the required book catalog

Create a program that maintains the required book catalog for the circulation desk of a library.

  Program to output value of tenth component of array

Write a C++ statements to perform the following: Set value of fourth component of array alpha to three times  value of eight component minus 57.

  The use of decision logic

The use of decision logic is one of the major concepts of computer programming.

  Insert the missing code in the c program

You are to insert the missing code in the C program given for combinational equivalence checking. This program will interface with the CUDD package and will parse netlist files in ISCAS85 circuit format. Next, BDDs will be created for each circuit an..

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