(Modify) Rewrite the following programs to conform to good
a. #include
int main(
){
cout <<
“The time has come”
; return 0;}
b. #include
using namespace std;
int main
( ){cout << “Newark is a city\n”;cout <<
“in New Jersey\n”; cout <<
“It is also a city\n”
; cout << “in Delaware\n”
; return 0;}
c. #include
using namespace std;
int main() {cout << Reading a program\n”;cout <<
“is much easier\n”
; cout << “if a standard form for main is used\n”
; cout
<<“and each statement is written\n”;cout
<< “on a line by itself\n”
; return 0;}
d. #include
using namespace std;
int main
( ){ cout << “Every C++ program”
; cout
<<“\nmust have one and only one”
;
cout << “main function”
;
cout <<
“\n The escape sequence of characters”)
; cout <<
“\nfor a newline can be placed anywhere”
; cout
<<“\n in the message passed to cout”
; return 0;}
Want to see the full answer?
Check out a sample textbook solutionChapter 2 Solutions
C++ for Engineers and Scientists
- (C PROGRAMMING ONLY) 3. From Person to Peopleby CodeChum Admin Now that we have created a Person, it's time to create more Person and this tech universe shall be filled with people! Instructions: In the code editor, you are provided with the definition of a struct Person. This struct needs an integer value for its age and character value for its gender. Furthermore, you are provided with a displayPerson() function which accepts a struct Person as its parameter. In the main() function, there's a pre-created array of 5 Persons.Your task is to ask the user for the values of the age and gender of these Persons.Then, once you've set their ages and genders, call the displayPerson() function and pass them one by one.Input 1. A series of ages and genders of the 5 Persons Output Person #1Enter Person's age: 24Enter Person's gender: M Person #2Enter Person's·age: 21Enter Person's gender: F Person #3Enter Person's age: 22Enter Person's gender: F Person #4Enter Person's age: 60Enter…arrow_forwardC++ Programming point* go_far(point* other) Return the point bearing the x- and the y- coordinates of whichever x- and y-coordinates is further from the origin. Identify which of the two points have the furthest x- and y-coordinates independently. Example: this point has (-5, 1) and the other point has (4, 9). In the x-coordinate of the two points, -5 is further from the origin than 4. In the y-coordinate of the two points, 9 is further from the origin than 1. Hence, we return a new point bearing the coordinates (-5, 9).arrow_forward(ONLY USE JAVA ARRAYS) USE JAVA LANGUAGE ONLY Telephone Directory SystemA telephone book system, also known as a telephone directory, telephone address book, or Phone book, isa listing of telephone subscribers in a geographical area or subscribers to services provided by theorganization that publishes the directory. Its purpose is to allow the telephone number of a subscriberidentified by name and address to be found. The features of telephone book system are mainly related toadding, listing, searching, sorting, modifying and deleting telephone directory-related records. Here weare going to create a java application for Telephone directory system.• Contact module: This module allows the user to enter all the details like auto-generated ID,name, phone number, city, country, residential address, website, mobile, company, and date ofbirth• Insert record: In this module, all the details regarding contacts are inserted.• Delete record: In this module, the records with a specific id or name…arrow_forward
- (Rounding Numbers) Function floor may be used to round a number to a specific decimalplace. The statementy = floor(x * 10 + .5) / 10;rounds x to the tenths position (the first position to the right of the decimal point). The statementy = floor(x * 100 + .5) / 100;rounds x to the hundredths position (the second position to the right of the decimal point). Writea program that defines four functions to round a number x in various waysa) roundToInteger(number)b) roundToTenths(number)c) roundToHundreths(number)d) roundToThousandths(number)For each value read, your program should print the original value, the number rounded to thenearest integer, the number rounded to the nearest tenth, the number rounded to the nearest hundredth, and the number rounded to the nearest thousandth.arrow_forwardQ1) Suppose we have data about students of a class i.e. name, addresses, date of birth, GPA and courses of study. This information is related to only a single entity i.e. student. Which type of programming method you will use to initialize and display this information. Explain with a program. Needed code in C++arrow_forward(USING PYTHON) create a function create employee_objects that takes a list of data as input and returns back a list with each element as an object that belongs to class Employee def create employee_objects (data): #start of code # end of code employees_list = create employee_objects (employees_data) Expected output: 29arrow_forward
- [C++] Please help to develop C++ codes based on the requirements below. (Requirement) Poker Hand Ranking Develop a program that determines to rank and display poker hands' ranking. When reading and displaying use letter representations for cards, e.g. Rank: 23 4 5 6789 10 J Q KA Suit: S HDC Use the set of hands below to demonstrate functionality. For example, demonstrate the three Straight Flush examples below as well as all of the other examplesarrow_forward(10 points) Filled out the following table regarding C++ STL and corresponding data structures that implement the STL class. C++ STL vector map set priority_queue unordered map unordered set Data Structure arrayarrow_forward(c programming only) #include<stdio.h> int main(void) { int destiny = 22; int *ptr1, *ptr2, *ptr3; // TODO: Fill in the blank ptr1 = ; ptr2 = ptr1; ptr3 = ptr2; printf("My destiny = %d", *ptr3); return 0;} Instructions: In the code editor, you are provided with an initial code where a constant variable is declared.Your only task is to assign the address of this variable to the first pointer found at line 9. Output My destiny = 11arrow_forward
- (c) What are the values of the variables incr, de cr, and total after the following code fragment is executed? int incr, decr = 7, total = 0; for (incr = 1; incr <= decr; ++incr) { t ot al += decr - incr; decr--; Answers: in cr de cr totalarrow_forwardQ1)There are 10 boxes of apples arranged in a row, assume the values have been stored in an arrayaryBox. Use C code to write a C program segment to find out which box is having the most number of applesas compared to other boxes. A sample output is as follow:Box number 5 contains the most number of apple.[Note: You need to declare all the necessary variables and use an efficient way to representthe data as well as solving the problem]arrow_forward(Card Shuffling and Dealing) Create a program to shuffle and deal a deck of cards. Theprogram should consist of class Card, class DeckOfCards and a driver program. Class Card shouldprovide:a) Data members face and suit of type int.b) A constructor that receives two ints representing the face and suit and uses them to initialize the data members.c) Two static arrays of strings representing the faces and suits.d) A toString function that returns the Card as a string in the form “face of suit.” Youcan use the + operator to concatenate strings.Class DeckOfCards should contain:a) An array of Cards named deck to store the Cards.b) An integer currentCard representing the next card to deal.c) A default constructor that initializes the Cards in the deck.d) A shuffle function that shuffles the Cards in the deck. The shuffle algorithm shoulditerate through the array of Cards. For each Card, randomly select another Card in thedeck and swap the two Cards.e) A dealCard function that returns the next…arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education