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

In the following shell scripting extract, the initial values of variables s, c and p are 0, 1, 1 respectively. What will be the

final value of s, at the end of the while loop?

Computers and Technology
1 answer:
____ [38]2 years ago
3 0

Answer:

The first example simply counts the number of lines in an input file. It does so by iterating over all lines of a file using a while loop, performing a read operation in the loop header. While there is a line to process, the loop body will be executed in this case simply increasing a counter by ((counter++)). Additionally the current line is written into a file, whose name is specified by the variable file, by echoing the value of the variable line and redirecting the standard output of the variable to $file. the current line to file. The latter is not needed for the line count, of course, but demonstrates how to check for success of an operation: the special variable $? will contain the return code from the previous command (the redirected echo). By Unix convention, success is indicated by a return code of 0, all other values are error code with application specific meaning.

Another important issue to consider is that the integer variable, over which iteration is performed should always count down so that the analysis can find a bound. This might require some restructuring of the code, as in the following example, where an explicit counter z is introduced for this purpose. After the loop, the line count and the contents of the last line are printed, using echo. Of course, there is a Linux command that already implements line-count functionality: wc (for word-count) prints, when called with option -l, the number of lines in the file. We use this to check wether our line count is correct, demonstrating numeric operations on the way.

You might be interested in
Which of the following is no longer necessary when you use HTML5 to develop Webpages? Please Hurry This Is For An Assignment due
zlopas [31]

Answer:

Installing a third-party plug-in to include video

Explanation:

5 0
2 years ago
In how many sections is the Add Animation pane divided? What is the utility of each section?​
NikAS [45]
It’s 45 sections they divided
3 0
3 years ago
Read 2 more answers
1. Fill in the blanks:
Anit [1.1K]

Answer:

<h2>a) computer software </h2>

<h2>b) flash drive</h2>

<h2>c) Latin "putare" </h2>

<h2>d) Hardware</h2>

<h2>e) software</h2>

hope it's helpful ✌

8 0
3 years ago
What is a focus of Accenture's point of view on blockchain in the marketplace?
Ipatiy [6.2K]

Answer:

enabling clients to store all their data, documents, and employee information on blockchain. accumulating the most data from wherever possible and building a comprehensive data lake.

Explanation:

4 0
2 years ago
Create a structure representing a student. The member variables should include student name, student ID, and four test grades fo
Neporo4naja [7]

Answer:

Output:

Name: Brainly

ID:0001

Write the 4 tests grades of the student separated by space :10 9 8 10

Brainly

0001

10 9 8 10

Average :9.66667

'1' to continue '0' to exit :

Explanation:

#include<iostream>

#include<string>

using namespace std;

//variables declaration

struct Student {

  string id; //string declaration ID

  string name; // string declaration name

  int grades[4]; //array of 4 because it is 4 grades

};

//definition of the function get information

void inputData(Student &s){

 

   

   cout << "Name:" ;

   getline(cin,s.name);

   cout << "ID:";

   cin >> s.id;

   cout << "Write the 4 tests grades of the student separated by space :";

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

       cin >> s.grades[i];

}

//definition of the function of average

double inputAvg(Student s){

   double summation;

   int temporary;

   double average;

   for (int i = 0; i<4; i++){  

      for (int j = i; j<4; j++){

         if (s.grades[j] > s.grades[i]){

             temporary = s.grades[i];

             s.grades[i] = s.grades[j];

             s.grades[j] = temporary;

         }

      }

    }

    summation = 0;

    for (int i = 0; i<3; i++){

        summation = summation + s.grades[i];  

    }

    average = summation/3;

    return average;

}

void disp(Student *s){

   cout << s->name << endl;

   cout << s->id << endl;

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

       cout << s->grades[i] << " ";

   cout << endl;

   cout << "Average :" << inputAvg(*s) << endl;

   

}

int main(){

  Student st;

  int ch;

  while(true){

      inputData(st);

      disp(&st);

      cout << " '1' to continue '0' to exit :";

      cin >> ch;

      if (ch == 0)

         break;      

  }

  return 0;

}

6 0
2 years ago
Other questions:
  • Which javascript method should you use if you want to specify a message string to appear on your web page as it loads?
    13·1 answer
  • Write a function called show_info that takes a name, a home city, and a home state (a total of 3 arguments) and returns a full s
    12·1 answer
  • Which of the following combines something you know, such as a password, with something you are (a biometric device such as a fin
    13·1 answer
  • Which of the following is NOT a fall prevention system?
    12·2 answers
  • What pointer appears when pointing to a hyperlink?
    9·1 answer
  • A browser allows you to set preferences for using the browser. These preferences include all of the following except
    7·1 answer
  • Write a formula that would return a TRUE result if the sum of the first five numbers in a column of data are negative
    7·1 answer
  • Write a SELECT statement that returns one row for each musician that has orders with these columns:
    13·1 answer
  • 2. Which of the following is a shortcut key to Exit from any operation?
    10·2 answers
  • 48
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!