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
fomenos
2 years ago
11

What is the difference between (IF instructions & WHILE instructions ) 0 를 들 T !

Computers and Technology
1 answer:
lara31 [8.8K]2 years ago
7 0

Answer:

While statements determine whether a statement is true or false. If what’s stated is true, then the program runs the statement and returns to the first step. If what’s stated is false, the program exits the while and goes to the next statement. An added step to while statements is turning them into continuous loops. If you don’t change the value so that the condition is never false, the while statement becomes an infinite loop.

If statements are the simplest form of conditional statements, statements that allow us to check conditions and change behavior/output accordingly. The part of the statement following the if is called the condition. If the condition is true, the instruction in the statement runs. If the condition is not true, it does not. The if statements are also compound statements. They have a header (if x) followed by an indented statement (an instruction to be followed is x is true). There is no limit to the number of these indented statements, but there must be at least one.

You might be interested in
Lottery Number Generator Design a program that generates a 7-digit lottery number. The program should have an Integer array with
Nikolay [14]

Answer:

/******************************************************************************

                             Online C++ Compiler.

              Code, Compile, Run and Debug C++ program online.

Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <iostream>

#include <string>

#include <sstream>

using namespace std;

bool equal(int sys[],int user[])

{

    for (int i=0;i<7;i++)

{

 if(sys[i]!=user[i]){

     return false;

 }

}

return true;

}

int main()

{

int sys[7];

int user[7];

int min=0

;int max=9;

string userinput;

while(0==0){

for (int i=0;i<7;i++)

{

    sys[i]=rand() % (max - min + 1) + min;

}

cout <<endl;

   cout<<"enter numbers"<<endl;

for (int i=0;i<7;i++)

{

 getline (cin,userinput);

    if(userinput=="x"){

        return 0;

    }

    else{

 stringstream(userinput) >> user[i];

   

    }

}

     cout<<"User number"<<endl;

for (int i=0;i<7;i++)

{

    cout << user[i];

}

    cout<<"system number"<<endl;

for (int i=0;i<7;i++)

{

    cout << sys[i];

}

if(equal(sys,user))

{

   cout<<"You won !"<<endl;

}else {

       cout<<"Try again :("<<endl;

}

}

   return 0;

}

Explanation:

Using c++ rand function generate a random number between 0-9.

Formula for random number is rand (max-min +1)+min.

Run this in a loop for 7 time and store each number to an array index in sys array which is for system generated number.

now using string take input from user and check if input is x close program else use stringstream to parse input string to int and store it in user array. Stringstream is a cpp header file used for parsing and handling of strin g inputs. Run this program in loop for 7 times.

Now create a function of type boolean denoted by "bool". This will take both arr as parameter and check if both are equal or not. It compares eac index of user array against each index of sys array and if both values are not equal returns false.

5 0
3 years ago
Design a 16K x 8 memory using the following ICs:
Montano1993 [528]

Answer:

Required memory size is 16k x 8

16k = 24 x 210 = 214

Hence, No. of address lines = 14

No. of data lines = 8

a) Size of IC 1024 x 1

Total number of ICs required = 16k x 8 / 1024 x 1 = 16 x 8 = 128

b) Size of IC 2k x 4

Total number of ICs required = 16k x 8 / 2k x 4 = 8 x 2 = 16

c) Size of IC 1k x 8

Total number of ICs required = 16k x 8 / 1k x 8 = 16 x 1 = 16

Explanation:

For a, 10 address lines from A0 to A9 are used to select any one of the memory location out of 1024 memory locations present in a IC.

For b, 11 address lines from A0 to A10 are used to select any one of the memory location out of 2k=2048 memory locations present in a IC.

For c, 10 address lines from A0 to A9 are used to select any one of the memory location out of 1k=1024 memory locations present in a IC.

3 0
3 years ago
What action requires a UV map?
CaHeK987 [17]
I would say drawing a polygon for a new model, assuming that the polygon would be converted to 3D to create the model.

(I really hope this helps)
5 0
2 years ago
In a ______________ graphic you can include text and pictures and you can apply colors, effects, and styles that coordinate with
DerKrebs [107]
In a presentation graphic
8 0
2 years ago
As the demand for goods and services decreases, job growth.
DanielleElmas [232]
B. Decreases because if nobody needs certain goods and services, people who sell that will go out of business
4 0
3 years ago
Read 2 more answers
Other questions:
  • In the range C15:G15, insert a function to calculate the total daily revenue. In the range H11:H15, insert a function to calcula
    8·1 answer
  • How to make logo black and white in paint?
    14·1 answer
  • The ____ refers to a world where everyday physical objects are connected to, and uniquely identifiable on, the Internet so they
    6·1 answer
  • Which of the following are points that can demonstrate the accuracy of a website?
    6·1 answer
  • Suppose there are two links between a source and a destination. The first link has transmission rate 100 Mbps and the second lin
    12·1 answer
  • What is a perfect hashing function?
    13·1 answer
  • Each Google My Business location has a unique ID that applies changes to the right listing.
    11·1 answer
  • 17. What are the basic modes of operation of 8255?Write the features of mode 0 in 8255?
    8·1 answer
  • Which type of information should never be given out on social media?
    5·2 answers
  • SUB2 WWolfPlays on yt <br><br><br> true or false if false ima cri
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!