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
. Java is a high-level language.. true or false?
frutty [35]

Answer:

the answer is true. it is a high level language

4 0
3 years ago
Could somebody please find the bugs and amend them? This question is worth 25 Brainly points!
Andreyy89

line 4

if salary < 30000

error missing ":"

solution

if salary < 30000:

line 6

tax = salary * 0.2

error is missing identifier for tax

solution add identifier for tax on line 3

tax = 0.0

line 11

error syntax

solution is move tax = salary * 0.4 + 6000 to the right

tax = salary * 0.4 + 6000

6 0
3 years ago
........ manages the function of all the hardware and other software used in the computer.
Ivenika [448]

Answer:

The answer to this question is given below is in the explanation section.

Explanation:

manages the function of all the hardware and other software used in the computer:

operating system is defined as a system software that manages computer hardware and software resources and provide common services for computers programs.All application software computer programs requires an operation system to  function. operating system controls computer hardware run the computer programs and organize file.

CPU:

central processing unit that bring the instruction from memory to be executed and decodes.

Storing device:

Any hardware that can hold information temporarily and permanently. we distinguish two type of storage: as primary storage device and a secondary storage device.

Example:

  1. Magnetic storage device:hard drive,floppy diskette etc.
  2. optical: Blu-ray disc,CD Rom disc.

Flash memory device:memory card memory sick,ssd

Hardware:

Hardware include the physical features,which are every part that you can either see or touch, for example monitor,case,keyboard,mouse and printer.

Software:

The part which activate the physical components called software. it includes the features that resposible for directing the work to the hardware.

8 0
3 years ago
Which of the following examples illustrates the Crowding Out Effect?
maks197457 [2]

your answer is c to what your looking for



6 0
2 years ago
You've been asked to find the average of a range of numbers. Which of the following could you use to find the average of cells A
labwork [276]

Answer:

D. =AVERAGE(A1:A10)

Explanation:

The answer is D.

With option A. It means the cell should contain the minimum figure in the range of cells <em>(A1:A10).</em>

With option B. It means the cell should contain the total sum of the figures in the range of cells <em>(A1:A10).</em>

With option C. It means the cell should contain the maximum figure of the range of cells <em>(A1:A10)</em>

5 0
3 years ago
Other questions:
  • When was Microsoft released to public schools?
    10·1 answer
  • I need help making this table in html code I have some of chart done but idk where to go after the 6:30pm part
    13·1 answer
  • If a computer is found to have an ip address of 169.254.1.1, what can you assume about how it received that ip address?
    11·1 answer
  • Why would it be beneficial to preview a page before printing?
    8·1 answer
  • Solve the following quadratic equation <br><br>y=6x^2-12x+1
    9·1 answer
  • In the context of intentional computer and network threats a ____ is a programming routine built into a system by its designer
    14·2 answers
  • When creating a shape in Word, what are some available options? Check all that apply. adding text to the shape changing the size
    6·1 answer
  • Steve is happy today but he ____ yesterday​
    7·2 answers
  • Write a program code which asks for 80 numbers between 100 and 1000 to be entered.
    7·1 answer
  • What is the best Describe an integer data type
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!