Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Lab Exercice 3_4 COEN 24: Due date: The lab demonstrator tells you the exact deadline. Read this entire document before beginning your lab. For this
Lab Exercice 3_4 COEN 24: Due date: The lab demonstrator tells you the exact deadline. Read this entire document before beginning your lab. For this lab you are required to fulfill all requirements exactly as described in this provided document, no less, no more. Question: Today you are to write a C++ program that asks the user to enter a positive number that is a power of 2 (you may use std::log and std::pow from the cmath library). If the user enters an integer that is not a power of 2, the program should continue prompting for a new number until the user enters the correct input. Then with the use of loops and nested loops you are supposed to produce a specific pattern as illustrated in the figures below. There must be a tab at the beginning of every line of numbers and a dash between each number. Be sure to use the same format as in the sample runs in the table below. Your code must work no matter what number the user enters. The box below illustrates how your program should behave and appear. Note 1: Assume the user always enters positive values of type integer (You do not need to check the negative and floating-point numbers)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started