Ask C/C++ Expert


Home >> C/C++

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.

C/C++, Programming

  • Category:- C/C++
  • Reference No.:- M9451825

Have any Question?


Related Questions in C/C++

Question 1find the minimum and maximum of a list of numbers

Question: 1. Find the Minimum and Maximum of a List of Numbers: 10 points File: find_min_max.cpp Write a program that reads some number of integers from the user and finds the minimum and maximum numbers in this list. Th ...

Software development fundamentals assignment 1 -details amp

Software Development Fundamentals Assignment 1 - Details & Problems - In this assignment, you are required to answer the short questions, identify error in the code, give output of the code and develop three C# Console P ...

What are the legal requirements with which websites must

What are the legal requirements with which websites must comply in order to meet the needs of persons with disabilities? Why is maximizing accessibility important to everyone?

There are several ways to calculate the pulse width of a

There are several ways to calculate the pulse width of a digital input signal. One method is to directly read the input pin and another method (more efficient) is to use a timer and pin change interrupt. Function startTi ...

Assignment word matchingwhats a six-letter word that has an

Assignment: Word Matching What's a six-letter word that has an e as its first, third, and fifth letter? Can you find an anagram of pine grave. Or how about a word that starts and ends with ant (other than ant itself, of ...

1 implement the binary search tree bst in c using the node

1. Implement the Binary Search Tree (BST) in C++, using the Node class template provided below. Please read the provided helper methods in class BST, especially for deleteValue(), make sure you get a fully understanding ...

Assign ment - genetic algorithmin this assignment you will

ASSIGN MENT - GENETIC ALGORITHM In this assignment, you will use your C programming skills to build a simple Genetic Algorithm. DESCRIPTION OF THE PROGRAM - CORE REQUIREMENTS - REQ1: Command-line arguments The user of yo ...

Project - space race part a console Project - Space Race Part A: Console Implementation

Project - Space Race Part A: Console Implementation INTRODUCTION This assignment aims to give you a real problem-solving experience, similar to what you might encounter in the workplace. You have been hired to complete a ...

Why do researcher drop the ewaste and where does it end

Why do researcher drop the ewaste and where does it end up?

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As