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
dmitriy555 [2]
3 years ago
6

When do you use an else statement for coding

Computers and Technology
1 answer:
tankabanditka [31]3 years ago
4 0

Answer:

to check to see if some expression is true, and if it is do something, otherwise do something else. An if/else statement requires you to define an expression that evaluates to true or false.

Explanation:

You might be interested in
Which of the following code segments will display all of the lines in the file object named infile, assuming that it has success
zimovet [89]

Answer:

d.

for line in infile :

   print(line)

Explanation:

for loop is used to iterate through the each line of the file using line variable. The file is accessed using the object infile. For example if the file name is "file.txt" and it is opened in read mode. It contains the following lines:

hi there friend

how are you

what are you doing

Then the above given chunk of code gives the following output

hi there friend

how are you

what are you doing

At each iteration each line of the the file is printed on the output screen. The print() method is used to display these lines in output.

5 0
3 years ago
Please explain this code line by line and how the values of each variable changes as you go down the code.
Scilla [17]

Answer:

hope this helps. I am also a learner like you. Please cross check my explanation.

Explanation:

#include

#include

using namespace std;

int main()

{

int a[ ] = {0, 0, 0};  //array declared initializing a0=0, a1=0, a3=0

int* p = &a[1]; //pointer p is initialized it will be holding the address of a1 which means when p will be called it will point to whatever is present at the address a1, right now it hold 0.

int* q = &a[0];  //pointer q is initialized it will be holding the address of a0 which means when q will be called it will point to whatever is present at the address a0, right now it hold 0.

q=p; // now q is also pointing towards what p is pointing both holds the same address that is &a[1]

*q=1 ; //&a[0] gets overwritten and now pointer q has integer 1......i am not sure abut this one

p = a; //p is now holding address of complete array a

*p=1; // a gets overwritten and now pointer q has integer 1......i am not sure abut this one  

int*& r = p; //not sure

int** s = &q; s is a double pointer means it has more capacity of storage than single pointer and is now holding address of q

r = *s + 1; //not sure

s= &r; //explained above

**s = 1; //explained above

return 0;

}

6 0
3 years ago
What are the benefits of open source software? Risks?
andrezito [222]

Answer:

more security

fewer bugs and faster fixes

no upgrade pushes

low coast

excellent support

as far as the risk part of it. I think that would be

the risk of license restriction, infringement.

5 0
3 years ago
How do you hack someone's wifi. (Hacker needed)​
Flauer [41]

Answer:

Ask God he knows all

Explanation:

3 0
3 years ago
Read 2 more answers
Suppose there is a text file named "datafile.txt with some data in the root directory of your computer". Using your choice of la
aivan3 [116]

Answer:

See explaination for program code

Explanation:

code below

using System;

using System.IO;

namespace ReadAndDisplayFileCOnsole

{

class Program

{

static void Main(string[] args)

{

using (StreamReader reader = new StreamReader("D:\\datafile.txt"))

{

while (true)

{

string line = reader.ReadLine();

if (line == null)

{

break;

}

Console.WriteLine(line);

}

reader.Close();

Console.Read();

}

}

}

}

6 0
3 years ago
Other questions:
  • A field whose data type is ____ can store text that can be used as a hyperlink address
    5·1 answer
  • When computers are connected and operate through one main computer, it is called a _________ network
    14·2 answers
  • Which of the following are pointers? Select all that are correct. hub node router transmission media switch port interconnector
    7·2 answers
  • The animation industry is solely reliant on 3-D modeling and 3-D virtualization to create the animated movies in the cinemas.
    9·2 answers
  • Convert the Binary Number to a Decimal Number
    13·1 answer
  • Vanessa and Marie are best friends. Vanessa tells Marie that one of their classmates has been posting nasty comments about Vanes
    10·2 answers
  • A computer connected to the Internet that asks for data is a(n) ________. Select one: A. server B. client C. aggregator D. surro
    8·1 answer
  • What is the determining criterion for removing older transactions from a company file
    9·1 answer
  • A student is having trouble finding enough time in his busy schedule to work on his school science project. He has a demanding s
    5·2 answers
  • Several users on the second floor of your company's building are reporting that the network is down. You go to the second floor
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!