Though we urge you not to
{
int x = 1;
cout << x << endl;
{
cout << x << endl;
int x = 2;
cout << x << endl ;
{
cout << x << endl ;
int x = 3;
cour << x << endl ;
}
cout << x << endl;
}
cout << x << endl ;
}
Want to see the full answer?
Check out a sample textbook solutionChapter 3 Solutions
Problem Solving with C++ (9th Edition)
Additional Engineering Textbook Solutions
Starting out with Visual C# (4th Edition)
Java: An Introduction to Problem Solving and Programming (7th Edition)
Starting Out with C++: Early Objects (9th Edition)
Concepts Of Programming Languages
Starting Out with Java: From Control Structures through Data Structures (3rd Edition)
Computer Science: An Overview (13th Edition) (What's New in Computer Science)
- Topical Information Use C++. The purpose of this project is to test your ability to use files, strings (Strings?), and libraries effectively in program design. Program Information A popular past-time is the word search puzzle (if you don't believe me, look in your daily paper and in the news stand in the check-out line at the grocery store). In such a puzzle, a grid of letters is presented which presumably contains words. However, the words are cleverly hidden among the other letters. Their camouflage is aided by them being aligned in many different orientations: horizontal, vertical, diagonal, and sometimes even backwards! The person's goal is to find the words and circle each one. Most often the person is also given a list of the words which should be found: apple hananabs pear mpearoap banana npsgrape grape uleapnbm orange…arrow_forwardimplement pass-by-value parameter passing method.USE C LANGUAGEarrow_forwardYou are to design a game that can be either single-player or multi-player (no AI required). Some example games are: • Standard card games • Connect four • Checkers • Oregon Trail • A game of your own creation! You should provide detailed instructions on what the code’s intended operation is. You must give sample input that tests the code rigorously for different scenarios. In C++ please.arrow_forward
- int p =5 , q =6; void foo ( int b , int c ) { b = 2 * c ; p = p + c ; c = 1 + p ; q = q * 2; print ( b + c ); } main () { foo (p , q ); print p , q ; } Explain and print the output of the above code when the parameters to the foo function are passed by value. Explain and print the output of the above code when the parameters to the foo function are passed by reference. Explain and print the output of the above code when the parameters to the foo function are passed by value result. Explain and print the output of the above code when the parameters to the foo function are passed by name.arrow_forwardLocal declarations are those that are kept in the memory of the computer; but, how exactly are they kept in memory? If reaching one's objective can be done without making use of local declarations, then doing so is a waste of time. Why bother using value parameters when you can just use references as your arguments in any function? How crucial are value parameters when it comes to the processing of programmed data?arrow_forwardIn java there must be at least two calls to the function with different arguments and the output must clearly show the task being performed. 1. Develop a function that accepts an array and returns true if the array contains any duplicate values or false if none of the values are repeated. 2. Develop a function that returns true if the elements are in decreasing order and false otherwise. 3. A "peak" is a value in an array that is preceded and followed by a strictly lower value. For example, in the array {2, 12, 9, 8, 5, 7, 3, 9} the values 12 and 7 are peaks. Develop a function that returns the number of peaks in an array of integers. Note that the first element does not have a preceding element and the last element is not followed by anything, so neither the first nor last elements can be peaks. 4. Develop a function that finds the starting index of the longest subsequence of values that is strictly increasing. For example, given the array {12, 3, 7, 5, 9, 8, 1, 4, 6}, the function…arrow_forward
- Please code in C++. Write a program that simulates a coin-tossing game. At the beginning of the game, each of N players has a single fair coin and M points. The game performs a sequence of passes until only a minimum number of players remain. In a pass the players toss their coins into the air and when the coins fall to earth, the players count the number of coins that show heads and the number of coins that show tails. If the number of heads exceed the number of tails, then the players who tossed heads increase their points by an integer P and the players who tossed tails decrease their points by the same integer P. The players perform the opposite actions when the number of tails is greater than the number of heads. If the number of heads equals the number of tails, then no player’s points change. If any player’s points fall below one, then the player leaves the game, never to return. The game employs a second integer K to compute P’s value. K’s and P’s initial values are one.…arrow_forwardC++ Create a Blackjack (21) game. Your version of the game will imagine only a SINGLE suit of cards, so 13 unique cards, {2,3,4,5,6,7,8,9,10,J,Q,K,A}. Upon starting, you will be given two cards from the set, non-repeating. Your program MUST then tell you the odds of receiving a beneficial card (that would put your value at 21 or less), and the odds of receiving a detrimental card (that would put your value over 21). Recall that the J, Q, and K cards are worth ‘10’ points, the A card can be worth either ‘1’ or ‘11’ points, and the other cards are worth their numerical values. FOR YOUR ASSIGNMENT: Provide two screenshots, one in which the game suggests it’s a good idea to get an extra card and the result, and one in which the game suggests it’s a bad idea to get an extra card, and the result of taking that extra card.arrow_forwardReviewing this program address the following points: Design/Implementation: Are there noticeable issues/flaws in the design and implementation of the code? How would you remedy such issues? Readability: Is the code well organized and easy to follow? Can you understand what is going on, easily? Documentation: Is the documentation well-written? does it explain what the code is accomplishing and how? Remember good documentation includes descriptive variable and function names in addition to clear/concise annotation. Efficiency: Was the code efficient, without sacrificing readability and understanding? #include <iostream> using namespace std; int main() { double meal, tax, tip, total; //create variables double taxPercentage = .0675, tipPercentage = .2; //initiate percentage values cout << "Enter a meal charge: \n"; cin >> meal; //enter meal tax = meal * taxPercentage; tip = (meal + tax) * tipPercentage; total = meal+tax+tip; cout…arrow_forward
- This is question 4.2 please do it for me with the explanationarrow_forwardI need help with this project that I've uploaded.arrow_forwardcreate a program in c that mimics the following dice game: A player rolls two dice. Each die has six faces. These faces contain 1, 2, 3, 4, 5, and 6 spots. After the dice have come to rest, the sum of the spots on the two upward faces is calculated. If the sum is 7 or 11 on the first throw, the player wins. If the sum is 2, 3, or 12 on the first throw the player loses. If the sum is 4, 5, 6, 8, 9, or 10 on the first throw, then the player must conitue to roll again until they roll that same number again in order to win. The player loses by rolling a 7 before making the point. Write a program in c that implements this game according to the above rules. The game should allow for wagering. This means that you need to prompt that user for an initial bank balance from which wagers will be added or subtracted. Before each roll prompt the user for a wager.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