Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need to do this in C++ Write a code segment that will prompt the user for a positive number, max, and display a table

I need to do this in C++

Write a code segment that will prompt the user for a positive number, max, and display a table of integers from 1 to max. Display only 5 integers in each row. For example, the user enters a max of 12.

1 2 3 4 5

6 7 8 9 10

11 12 So far I haveI have to use a printf

cout << "Enter a positive number: ";

cin >> postable;

if ( postable > 0 )

for ( int x=1 ; postable >= x ; x++)

printf ( "%3d" , x );

I can't get it to only have 5 integers a row.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Fundamentals Of Database Management Systems

Authors: Mark L. Gillenson

3rd Edition

978-1119907466

More Books

Students also viewed these Databases questions