Assume that scotus is a two-dimensional character array that stores the family names (last names ) of the nine justices on the Supreme Court of the United States. Assume no name is longer than twenty characters. Assume that scotus has been initialized in alphabetical order. Write an expression whose value is the last name stored in the array .

C++

LANGUAGE: C++ CHALLENGE: Assume that scotus is a two-dimensional character array that stores the family names (last names ) of the nine justices on the Supreme Court of the United States. Assume no name is longer than twenty characters. Assume that scotus has been initialized in alphabetical order. Write an expression whose value is the…

Read More

Assume the existence of a Window class with integer data members width and height. Overload the >> operator for the Window class — i.e., write a nonmember istream-returning function that accepts a reference to an istream object and a reference to a Window object and reads the next two values from the istream in to the width and height members respectively. Don’t forget to have the function return the proper value as well. Assume the operator has been declared a friend in the Window class .

C++

LANGUAGE: C++ CHALLENGE: Assume the existence of a Window class with integer data members width and height. Overload the >> operator for the Window class — i.e., write a nonmember istream-returning function that accepts a reference to an istream object and a reference to a Window object and reads the next two values from the…

Read More

Assume the existence of a Window class with integer data members width and height. Overload the << operator for the Window class -- i.e., write a nonmember ostream-returning function that accepts a reference to an ostream object and a constant reference to a Window object and sends the following to the ostream: 'a (width x height) window' (without the quotes and with width and height replaced by the actual width and height of the window. Thus for example, if the window had width=80 and height=20, << would send 'a (80 x 20) window' to the ostream.) Don't forget to have the function return the proper value as well. Assume the operator has been declared a friend in the Window class .

C++

LANGUAGE: C++ CHALLENGE: Assume the existence of a Window class with integer data members width and height. Overload the << operator for the Window class — i.e., write a nonmember ostream-returning function that accepts a reference to an ostream object and a constant reference to a Window object and sends the following to the ostream:…

Read More

Write a fragment of code that reads a line of text (using getline) from standard input consisting of a last name followed by a first name (separated by exactly one blank), and prints out the first initial followed by a period then a blank then the full last name. Declare any necessary variables. (string processing)

C++

LANGUAGE: C++ CHALLENGE: Write a fragment of code that reads a line of text (using getline) from standard input consisting of a last name followed by a first name (separated by exactly one blank), and prints out the first initial followed by a period then a blank then the full last name. Declare any necessary…

Read More

Define the following Window class : – integer data members, width and height – a constructor that accepts two integer parameters (width followed by height) and uses them to initialize the data members – a friend function, areSameSize, that accepts two Window objects and returns a boolean indicating if they are the same size. Two windows are the same size if the widths and heights match.

C++

LANGUAGE: C++ CHALLENGE: Define the following Window class : – integer data members, width and height – a constructor that accepts two integer parameters (width followed by height) and uses them to initialize the data members – a friend function, areSameSize, that accepts two Window objects and returns a boolean indicating if they are the…

Read More

Assume the existence of a File class with boolean data member, isValid, indicating the file is ready for I/O. Write a unary operator, !, that accepts a constant File reference, and returns true if the file is not ready for I/O and false otherwise.

C++

LANGUAGE: C++ CHALLENGE: Assume the existence of a File class with boolean data member, isValid, indicating the file is ready for I/O. Write a unary operator, !, that accepts a constant File reference, and returns true if the file is not ready for I/O and false otherwise.

Read More