Question

Auto-graded programming assignments have numerous advantages, but have some challenges too. Students commonly struggle with realizing...

Auto-graded programming assignments have numerous advantages, but have some challenges too. Students commonly struggle with realizing that example input / output provided in an assignment's specification interleaves input and output, but the program should only output the output parts. If a program should double its input, an instructor might provide this example:

Enter x: 
5
x doubled is: 10

Students often incorrectly create a program that outputs the 5. Instead, the program should only output the output parts:

Enter x:
x doubled is: 10

The instructor's example is showing both the output of the program, AND the user's input to that program, assuming the program is developed in an environment where a user is interacting with a program. But the program itself doesn't output the 5 (or the newline following the 5, which occurs when the user types 5 and presses enter).

Also, if the instructor configured the test cases to observe whitespace, then according to the above example, the program should output a newline after Enter x: (and possibly after the 10, if the instructor's test case expects that).

The program below incorrectly echoes the user's input to the output.

  1. Try submitting it for grading (click "Submit mode", then "Submit for grading"). Notice that the test cases fail. The first test case's highlighting indicates that output 3 and newline were not expected. In the second test case, the -5 and newline were not expected.
  2. Remove the code that echoes the user's input back to the output, and submit again. Now the test cases should all pass.

#include <iostream>
using namespace std;

int main() {
   int x;

   cout << "Enter x: " << endl;
   cin >> x;

   cout << x << endl; // Student mistakenly is echo'ing the input to output to match example
   cout << "x doubled is: " << 2 * x << endl;

   return 0;
}

0 0
Add a comment Improve this question Transcribed image text
Answer #1
#include <iostream>

using namespace std;

int main() {
    int x;

    cout << "Enter x: " << endl;
    cin >> x;

    cout << "x doubled is: " << 2 * x << endl;
    return 0;
}
Add a comment
Know the answer?
Add Answer to:
Auto-graded programming assignments have numerous advantages, but have some challenges too. Students commonly struggle with realizing...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • byst x Grades for Lewis Dickerson: (Sun X MindTap - Cengage Learning х Python Programming |...

    byst x Grades for Lewis Dickerson: (Sun X MindTap - Cengage Learning х Python Programming | Facebook x war Python: Inp Cengage.com/static/nb/ui/evo/index.html?deploymentid=58296224090012788153144858955&eISBN=9781337560115&id=811000539&snap CENGAGE MINDTAP Programming Exercise 1.7 Instructions myinfo.py ols V- 1 name= input 2 age = int(in 3 print("Alex Write and test a program that accepts the user's name (as text) and age (as a number) as input. . 4 The program should output a sentence containing the user's name and age. S An example of the program input...

  • Professor Dolittle has asked some computer science students to write a program that will help him...

    Professor Dolittle has asked some computer science students to write a program that will help him calculate his final grades. Professor Dolittle gives two midterms and a final exam. Each of these is worth 100 points. In addition, he gives a number of homework assignments during the semester. Each homework assignment is worth 100 points. At the end of the semester, Professor Dolittle wants to calculate the median score on the homework assignments for the semester. He believes that the...

  • how do you insert a print command that changes with what name you type? = Syst...

    how do you insert a print command that changes with what name you type? = Syst x Grades for Lewis Dickerson: [Sum X MindTap - Cengage Learning X Python Programming | Facebook X war Python: cengage.com/static/nb/ui/evo/index.html?deploymentid=58296224090012788153144858955&eISBN=9781337560115&id=8110005398.sn CENGAGE MINDTAP Programming Exercise 1.7 Instructions myinfo.py name = inpu 2 age = input 3 print (name Cools Write and test a program that accepts the user's name (as text) and age (as a number) as input. اراء The program should output a sentence...

  • Assignment Develop a program to analyze one or more numbers entered by a user. The user...

    Assignment Develop a program to analyze one or more numbers entered by a user. The user may enter one or more numbers for analysis. Input should be limited to numbers from 1 through 1000. Determine if a number is a prime number or not. A prime number is one whose only exact divisors are 1 and the number itself (such as 2, 3, 5, 7, etc.). For non-prime numbers, output a list of all divisors of the number. Format your...

  • Need some assistance of reorganizing this whole program. I have the right code for everything I...

    Need some assistance of reorganizing this whole program. I have the right code for everything I just need help on putting all the codes in the right spot so it can come out to the correct output. output is supposed to look like this: 1 \\ user inputs choice to convert 12 to 24 8 \\ user inputs 8 for hours 30 \\ user inputs 30 for minutes 20 \\ user inputs 20 for seconds AM \\ user inputs AM...

  • A) One of the problems that have been discussed in the class is to write a simple C++ program to ...

    C++ programming question will upvote A) One of the problems that have been discussed in the class is to write a simple C++ program to determine the area and circumference of a circle of a given radius. In this lab you will be rewriting the program again but this time you will be writing some functions to take care of the user input and math. Specifically, your main function should look like the following int main //the radius of the...

  • Hello, I have some errors in my C++ code when I try to debug it. I...

    Hello, I have some errors in my C++ code when I try to debug it. I tried to follow the requirements stated below: Code: // Linked.h #ifndef INTLINKEDQUEUE #define INTLINKEDQUEUE #include <iostream> usingnamespace std; class IntLinkedQueue { private: struct Node { int data; Node *next; }; Node *front; // -> first item Node *rear; // -> last item Node *p; // traversal position Node *pp ; // previous position int size; // number of elements in the queue public: IntLinkedQueue();...

  • so i have my c++ code and ive been working on this for hours but i...

    so i have my c++ code and ive been working on this for hours but i cant get it to run im not allowed to use arrays. im not sure how to fix it thank you for the help our job is to write a menu driven program that can convert to display Morse Code ere is the menu the program should display Menu Alphabet Initials N-Numbers - Punctuations S = User Sentence Q- Quit Enter command the user chooses...

  • I don't know how to terminate the code in the second time that whether or not...

    I don't know how to terminate the code in the second time that whether or not the users want to continue to get a new number. PLEASE HELP. To make telephone numbers easier to remember, some companies use letters to show their telephone number. For example, using letters, the telephone number 438-5626 can be shown as GET LOAN. In some cases, to make a telephone number meaningful, companies might use more than seven letters. For example, 225-5466 can be displayed...

  • In this lab, you will need to implement the following functions in Text ADT with C++...

    In this lab, you will need to implement the following functions in Text ADT with C++ language(Not C#, Not Java please!): PS: The program I'm using is Visual Studio just to be aware of the format. And I have provided all informations already! Please finish step 1, 2, 3, 4. Code is the correct format of C++ code. a. Constructors and operator = b. Destructor c. Text operations (length, subscript, clear) 1. Implement the aforementioned operations in the Text ADT...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT