2.14 Characters

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

Goal output: Say "Hello" cout << _____ ;

"Say \"Hello\""

Given string "a\"b", the first character is stored in memory as 97 (the numeric value for 'a'). What is stored for the second character?

34

'&' is stored as _____.

38

'A' is stored as ______.

65

7 is stored as _____.

7

Goal output: OK bye (Assume a tab exists between OK and bye). cout << _____ ;

OK\tbye

A variable's memory location stores 88. Outputting that value as a character yields _____.

X

Define a character variable middleInitial.

char middleInitial;

Print a message telling a user to press the letterToQuit key numPresses times to quit. End with newline. Ex: If letterToQuit = 'q' and numPresses = 2, print: Press the q key 2 times to quit. #include <iostream> using namespace std; int main() { char letterToQuit; int numPresses; cin >> letterToQuit; cin >> numPresses; Write here return 0; }

cout << "Press the " << letterToQuit <<" key " << numPresses << " times to quit." << endl

Output all combinations of character variables a, b, and c, using this ordering: abc acb bac bca cab cba So if a = 'x', b = 'y', and c = 'z', then the output is: xyz xzy yxz yzx zxy zyx Your code will be tested in three different programs, with a, b, c assigned with 'x', 'y', 'z', then with '#', '$', '%', then with '1', '2', '3'. #include <iostream> using namespace std; int main() { char a; char b; char c; a = 'x'; b = 'y'; c = 'z'; Write here cout << endl; return 0; }

cout<<a<<b<<c<<" "; cout<<a<<c<<b<<" "; cout<<b<<a<<c<<" "; cout<<b<<c<<a<<" "; cout<<c<<a<<b<<" "; cout<<c<<b<<a<<"";

Assume char variable userKey is already declared. Write a statement that assigns userKey with the letter a.

userKey = 'a';


Ensembles d'études connexes

Chapter 28: Management of Patients with Structural, Infectious and Inflammatory Cardiac Disorders

View Set

Chapter 39: Caring for Clients With Head and Spinal Cord Trauma

View Set

Mood Disorders, CONVERSION DISORDER, post-traumatic stress disorder (PTSD), Chapter 15 Psychological Disorders, Psychology vocab ch. 12, psychological disorders, Schizophrenia, Psych: Module 4

View Set

Microeconomics Chapter 9,10,11,12,13,14, Exam Review

View Set