1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Levart [38]
2 years ago
8

2. Integer plot function (find a smart way to code big integers) Write a program BigInt(n) that displays an arbitrary positive i

nteger n using big characters of size 7x7, as in the following example for BigInt(170): @@@@@@ @@ @@@@@ Write a demo main program that illustrates the work of BigInt(n) and prints the following sequence of big numbers 1, 12, 123, 1234, ..., 1234567890, one below the other.

Computers and Technology
1 answer:
Shalnov [3]2 years ago
4 0

Answer:

The program is coded in C++ language, Complete code along with explanation and output is provided below.

C++ Code:  

#include <iostream>

using namespace std;

void print(int N, int L);  

void big_int(int num)

{

int L;

int N;

int count = 0;

int array[100];

while(num > 0)

{

int digit = num % 10;

array[count] = digit;

num = num/10;

count++;

}

for(L = 1; L <= 7; L++)   // for 7 lines

{

for(N = count - 1; N >= 0; N--)

{

   print(array[N], L);  // call the print function

}

cout<<endl;

}

return;

}

void print(int N, int L)

{

   switch(N)

{

case 0:

  if(L == 1){         cout<<" *****  ";}

  else if(L == 2){ cout<<"**   ** ";}

  else if(L == 3){ cout<<"**   ** ";}

  else if(L == 4){ cout<<"**   ** ";}

  else if(L == 5){ cout<<"**   ** ";}

  else if(L == 6){ cout<<"**   ** ";}

  else if(L == 7){ cout<<" *****  ";}

  else{cout<<"Invalid line"<<endl;}

  break;

 case 1:

  if(L == 1){      cout<<"  ***   ";}

  else if(L == 2){ cout<<"*****   ";}

  else if(L == 3){ cout<<"  ***   ";}

  else if(L == 4){ cout<<"  ***   ";}

  else if(L == 5){ cout<<"  ***   ";}

  else if(L == 6){ cout<<"  ***   ";}

  else if(L == 7){ cout<<"******* ";}

  else{cout<<"Invalid line"<<endl;}

  break;

 case 2:

  if(L == 1){      cout<<" *****  ";}

  else if(L == 2){ cout<<"**   ** ";}

  else if(L == 3){ cout<<"     ** ";}

  else if(L == 4){ cout<<"    **  ";}

  else if(L == 5){ cout<<"   **   ";}

  else if(L == 6){ cout<<" ***    ";}

  else if(L == 7){ cout<<"******* ";}

  else{cout<<"Invalid line"<<endl;}

  break;

 case 3:

  if(L == 1){      cout<<" *****  ";}

  else if(L == 2){ cout<<"*    ** ";}

  else if(L == 3){ cout<<"    *** ";}

  else if(L == 4){ cout<<" ****   ";}

  else if(L == 5){ cout<<"    *** ";}

  else if(L == 6){ cout<<"*    ** ";}

  else if(L == 7){ cout<<" *****  ";}

  else{cout<<"Invalid line"<<endl;}

  break;

 case 4:

  if(L == 1){       cout<<"   **   ";}

  else if(L == 2){ cout<<"  ***   ";}

  else if(L == 3){ cout<<" * **   ";}

  else if(L == 4){ cout<<"*  **   ";}

  else if(L == 5){ cout<<"******* ";}

  else if(L == 6){ cout<<"   **   ";}

  else if(L == 7){ cout<<"   **   ";}

  else{cout<<"Invalid line"<<endl;}

  break;

 case 5:

  if(L == 1){      cout<<"******* ";}

  else if(L == 2){ cout<<"**      ";}

  else if(L == 3){ cout<<"**      ";}

  else if(L == 4){ cout<<"******  ";}

  else if(L == 5){ cout<<"     ** ";}

  else if(L == 6){ cout<<"*    ** ";}

  else if(L == 7){ cout<<" *****  ";}

  else{cout<<"Invalid line"<<endl;}

  break;

 case 6:

  if(L == 1){      cout<<" *****  ";}

  else if(L == 2){ cout<<"**   ** ";}

  else if(L == 3){ cout<<"**      ";}

  else if(L == 4){ cout<<"******  ";}

  else if(L == 5){ cout<<"**   ** ";}

  else if(L == 6){ cout<<"**   ** ";}

  else if(L == 7){ cout<<" *****  ";}

  else{cout<<"Invalid line"<<endl;}

  break;

 case 7:

  if(L == 1){      cout<<"******* ";}

  else if(L == 2){ cout<<"**   ** ";}

  else if(L == 3){ cout<<"     ** ";}

  else if(L == 4){ cout<<"    **  ";}

  else if(L == 5){ cout<<"   **   ";}

  else if(L == 6){ cout<<"  **    ";}

  else if(L == 7){ cout<<" **     ";}

  else{cout<<"Invalid line"<<endl;}

  break;

 case 8:

  if(L == 1){      cout<<" *****  ";}

  else if(L == 2){ cout<<"**   ** ";}

  else if(L == 3){ cout<<"**   ** ";}

  else if(L == 4){ cout<<"******* ";}

  else if(L == 5){ cout<<"**   ** ";}

  else if(L == 6){ cout<<"**   ** ";}

  else if(L == 7){ cout<<" *****  ";}

  else{cout<<"Invalid line"<<endl;}

  break;

 case 9:

  if(L == 1){      cout<<" *****  ";}

  else if(L == 2){ cout<<"**   ** ";}

  else if(L == 3){ cout<<"**   ** ";}

  else if(L == 4){ cout<<" ****** ";}

  else if(L == 5){ cout<<"     ** ";}

  else if(L == 6){ cout<<"**   ** ";}

  else if(L == 7){ cout<<" *****  ";}

  else{cout<<"Invalid line"<<endl;}

  break;

 default:

           {cout<<"Invalid Input!"<<endl;}

}

}

// driver code

int main()

{

big_int(123);    

big_int(123456);

big_int(123456789);

return 0;

}

Explanation:

We have created two functions:

1. void print(int N, int L)

This function is used to print numbers and contains the individual big integers of the size 7 by 7. A switch method is used to select correcting digit. It takes two input arguments, N is the number from 0 to 9 and L is the line number.

2. void big_int(int num)

This function is used to implement the logic. A while loop is used until all N numbers are printed. One for loop calls the print function inside a for loop to print the numbers. Another loop is used to for the 7 rows to start new lines.

In the driver code, we called the big_int function to print several numbers.

Output:

Please refer to the attached image.

You might be interested in
no one can succeed in his or her career without relying on others for help or opportunities. It’s best, though,
fenix001 [56]

idk good luck man idek if this is a question but if it is just go with c or b

3 0
2 years ago
What is a WYSIWYG program?
DanielleElmas [232]
D will be the answer a program that allows you to take a tutorial on html terminology
5 0
2 years ago
Read 2 more answers
A user calls your help desk to report that the files on her USB stick do not have any permissions associated with them and there
Delicious77 [7]
It is (D) because FAT 32 is the most secure option that is why it is most popular
7 0
3 years ago
Read 2 more answers
Software that people commonly use in the workplace to make their lives easier is called
Lorico [155]
Software that people commonly use in the workplace to make their lives easier is called system software.
4 0
2 years ago
This is tech question related to mobile and PC.
love history [14]

I am guessing the bluetooth process is same as usb proccess. So when i transfered a video via usb and took out the usb (for apple phone), there <u>was</u> a file but when i clicked it it said that the phone isn't plugged in

4 0
3 years ago
Other questions:
  • Which of the following would likely be covered under homeowners insurance but NOT by renter's insurance?
    9·2 answers
  • Which version of Windows was considered an operating environment rather than an operating system? Windows 1.0 Windows 3.0 Window
    9·1 answer
  • When using a function to preform a calculation how would you select the range of numbers to use
    13·1 answer
  • A(n) ________ operator, such as the greater than or less than symbol, can be used in a query criterion to limits the results pro
    12·2 answers
  • A special type of loans for houses
    9·2 answers
  • Project manager Erica is discussing with her team to prepare a document to describe the deliverables and goals of a software pro
    13·1 answer
  • HI brainly friends....<br> Pease thanks my answers I will also thank your answers
    11·1 answer
  • Trace the evaluation of the following expressions, and give their resulting values. Make sure to give a value of the appropriate
    11·1 answer
  • What are some example of popular music for teenagers
    8·2 answers
  • Why must web designers select a common font?​
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!