Debugglng Informatlon for Loco overTime O DESCRIPTION Value too high DEBUG INFO Your instructor has chosen to give you the following information to help you debug your code and improve your submission. COMPILER STACK TRACE None PROGRAM EXECUTION STACK TRACE None INPUT OF THE TEST CASE 1 Loco 2 5900 YOUR CODE'S OUTPUT 1 what is your name? What time is it? (0-2400)What are you doing up, Loco 2 THE CORRECT OUTPUT OF THE TEST CASE 1 What is your name? What time is it? (0-2400)That is an illegal time, Loco 2 "UNIX DIFF OF CORRECT OUTPUT AND YOUR OUTPUT 1c1 < what is your name? What time is it? (0-2400)What are you doing up, Loco > what is your name? What time is it? (0-2400)That is an illegal time, Loco PRETTY DIFF This diff is colored to make it clear what parts of the output are wrong. Green indicates things in the correct output that you are mlssing, red indicates things in your output that shouldn't be there. The - character refers to newlines, so the green - character refers a newline you are missing in your output and the red refers to a newiline you need to remove from your output. 1 what is your name? What time is it? (0-2400)WThat areis youan doinllegal uptime, Locod Debugglng Informatlon for Loca crazytlme O DEBUG INFO Your instructor has chosen to give you the following information to help you debug your code and improve your submission. COMPILER STACK TRACE None PROGRAM EXECUTION STACK TRACE None INPUT OF THE TEST CASE 1 Loca 2 -1200 YOUR CODE'S OUTPUT 1 what is your name? What time is it? (0-2400)What are you doing up, Loca 2 THE CORRECT OUTPUT OF THE TEST CASE 1 what is your name? What time is it? (0-2400)That is an illegal time, Loca 2 "UNIX DIFF OF CORRECT OUTPUT AND YOUR OUTPUT 1c1 < what is your name? What time is it? (0-2400)What are you doing up, Loca > what is your name? What time is it? (0-2400)That is an illegal time, Loca PRETTY DIFF This diff is colored to make it clear what parts of the output are wrong. Green indicates things in the correct output that you are mlssing, red indicates things in your output that shouldn't be there. The a character refers to newlines, so the green character refers a newline you are missing in your output and the red refers to a newiline you need to remove from your output. 1 what is your name? What time is it? (0-2400)WThat areis youan doinllegal uptime, Locad TIT

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
100%

having some issues with my c++ code.

Below I have attached the a screenshot of the errors I receive when I run it. For both of them it should say  that is an illegal time instead of what are you doing up.

My code:

#include <iostream>

#include <string>

using namespace std;

 

//method to compute the greeting at a certain time

string time2greeting(int time)

{

//create a string to hold greatings

string greeting;

 

//if time is between 11PM and 4AM

if (time > 2259 || time < 400)

//set the greating " What are you doing up,"

greeting = "What are you doing up, ";

 

//if time is between from 5PM to 11PM

else if (time > 1659)

//set the greeting "good evening"

greeting = "Good Evening, ";

 

//if time is from Noon to before 5PM

else if (time > 1159)

//set the greeting "good Afternoon"

greeting = "Good Afternoon, ";

 

//if time is greater tha 359

else if (time > 359)

//set the greeting "good Morning"

greeting = "Good Morning, ";

 

//For illegal values, say:

else

//set the greeting

greeting = "That is an illegal time, ";

 

//return the greeting

return greeting;

}

//define main method

int main()

{

//declare the variables

string name, greeting;

int time;

 

//prompt the user to enter the name

cout << "What is your name? ";

 

//scan for the value

cin >> name;

 

//prompt the user to enter the time

cout << "What time is it? (0-2400)";

 

//scan for the time

cin >> time;

 

// call and print time2greeting

greeting = time2greeting(time);

 

//print the output

cout << greeting << " " << name << endl;

 

//return

return(0);

}

 

Debugglng Informatlon for Loco overTime O
DESCRIPTION
Value too high
DEBUG INFO
Your instructor has chosen to give you the following information to help you debug your code and improve your submission.
COMPILER STACK TRACE
None
PROGRAM EXECUTION STACK TRACE
None
INPUT OF THE TEST CASE
1 Loco
2 5900
YOUR CODE'S OUTPUT
1 what is your name? What time is it? (0-2400)What are you doing up, Loco
2
THE CORRECT OUTPUT OF THE TEST CASE
1 What is your name? What time is it? (0-2400)That is an illegal time, Loco
2
"UNIX DIFF OF CORRECT OUTPUT AND YOUR OUTPUT
1c1
< what is your name? What time is it? (0-2400)What are you doing up, Loco
> what is your name? What time is it? (0-2400)That is an illegal time, Loco
PRETTY DIFF
This diff is colored to make it clear what parts of the output are wrong. Green indicates things in the correct output that you are mlssing, red indicates
things in your output that shouldn't be there.
The - character refers to newlines, so the green - character refers a newline you are missing in your output and the red refers to a newiline you
need to remove from your output.
1 what is your name? What time is it? (0-2400)WThat areis youan doinllegal uptime,
Locod
Transcribed Image Text:Debugglng Informatlon for Loco overTime O DESCRIPTION Value too high DEBUG INFO Your instructor has chosen to give you the following information to help you debug your code and improve your submission. COMPILER STACK TRACE None PROGRAM EXECUTION STACK TRACE None INPUT OF THE TEST CASE 1 Loco 2 5900 YOUR CODE'S OUTPUT 1 what is your name? What time is it? (0-2400)What are you doing up, Loco 2 THE CORRECT OUTPUT OF THE TEST CASE 1 What is your name? What time is it? (0-2400)That is an illegal time, Loco 2 "UNIX DIFF OF CORRECT OUTPUT AND YOUR OUTPUT 1c1 < what is your name? What time is it? (0-2400)What are you doing up, Loco > what is your name? What time is it? (0-2400)That is an illegal time, Loco PRETTY DIFF This diff is colored to make it clear what parts of the output are wrong. Green indicates things in the correct output that you are mlssing, red indicates things in your output that shouldn't be there. The - character refers to newlines, so the green - character refers a newline you are missing in your output and the red refers to a newiline you need to remove from your output. 1 what is your name? What time is it? (0-2400)WThat areis youan doinllegal uptime, Locod
Debugglng Informatlon for Loca crazytlme O
DEBUG INFO
Your instructor has chosen to give you the following information to help you debug your code and improve your submission.
COMPILER STACK TRACE
None
PROGRAM EXECUTION STACK TRACE
None
INPUT OF THE TEST CASE
1 Loca
2 -1200
YOUR CODE'S OUTPUT
1 what is your name? What time is it? (0-2400)What are you doing up, Loca
2
THE CORRECT OUTPUT OF THE TEST CASE
1 what is your name? What time is it? (0-2400)That is an illegal time, Loca
2
"UNIX DIFF OF CORRECT OUTPUT AND YOUR OUTPUT
1c1
< what is your name? What time is it? (0-2400)What are you doing up,
Loca
> what is your name? What time is it? (0-2400)That is an illegal time, Loca
PRETTY DIFF
This diff is colored to make it clear what parts of the output are wrong. Green indicates things in the correct output that you are mlssing, red indicates
things in your output that shouldn't be there.
The a character refers to newlines, so the green character refers a newline you are missing in your output and the red refers to a newiline you
need to remove from your output.
1 what is your name? What time is it? (0-2400)WThat areis youan doinllegal uptime, Locad
TIT
Transcribed Image Text:Debugglng Informatlon for Loca crazytlme O DEBUG INFO Your instructor has chosen to give you the following information to help you debug your code and improve your submission. COMPILER STACK TRACE None PROGRAM EXECUTION STACK TRACE None INPUT OF THE TEST CASE 1 Loca 2 -1200 YOUR CODE'S OUTPUT 1 what is your name? What time is it? (0-2400)What are you doing up, Loca 2 THE CORRECT OUTPUT OF THE TEST CASE 1 what is your name? What time is it? (0-2400)That is an illegal time, Loca 2 "UNIX DIFF OF CORRECT OUTPUT AND YOUR OUTPUT 1c1 < what is your name? What time is it? (0-2400)What are you doing up, Loca > what is your name? What time is it? (0-2400)That is an illegal time, Loca PRETTY DIFF This diff is colored to make it clear what parts of the output are wrong. Green indicates things in the correct output that you are mlssing, red indicates things in your output that shouldn't be there. The a character refers to newlines, so the green character refers a newline you are missing in your output and the red refers to a newiline you need to remove from your output. 1 what is your name? What time is it? (0-2400)WThat areis youan doinllegal uptime, Locad TIT
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 5 steps with 10 images

Blurred answer
Knowledge Booster
Reference Types in Function
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education