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

  Design a nested program

How many levels of nesting are there in this design?

  Write a function that takes an integer array

1. Write a function that takes an integer array and the array's size as parameters. The function will check if the array is sorted. If it is, it will return a 1. If it is not sorted it will return 0. The function should not  sort the array.

  Native method with deadlock detection and recovery

The naïve method with deadlock avoidance and the naïve method with deadlock detection and recovery - what will you measure and compare in order to determine the winner or which is better

  Write a program that will be used to gather statistical data

Write a program that will be used to gather statistical data about the number of movies

  Determine order in which constructors of class will execute

Suppose that an object of class three enters its scope, so the constructors of theses classes will execute. Determine the order in which the constructors of these classes will execute.

  Write a c++ program containing a linked list of 10 integer

Write a C++ program containing a linked list of 10 integer numbers. Have the program display the numbers in the list.

  Why does the neverwet spray protect it from water

As is know, acetone is a polar molecule like water, so isn't it suppose to mix? So my question is: why does the Neverwet spray protect it from water but not from oils and detergents?

  Prepare a program that uses the pthread library

Prepare a C/C++ program that uses the PTHREAD library to create threads and mutexes to synchronize them.

  Initialize an array and fill the array with the gpa values.

Write a program in java that asks user input (using a loop) for name of 10 student and the corresponding grade point averages (GPAs). Initialize an array and fill the array with the GPA values.

  Distinguish syntax and purpose of while-loop and for-loop

Distinguish the syntax and purpose of while-loop and syntax of a for-loop. Give C++ code examples of both loops and descriibe the main differences.

  Implement recursive algorithms using a stack

Show the difficulties of the added complexity and which of the two sorts is easier to implement nonrecursively? Why?

  Write c program that forks two child processes

Write a C program that forks two child processes. The parent process will print all prime numbers up to 229, the first child process will print the first 50 Fibonacci numbers.

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