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
Svetlanka [38]
3 years ago
11

When possible, you should avoid using _________ variables in a program?

Computers and Technology
1 answer:
dalvyx [7]3 years ago
4 0

Answer:

Global variable

Explanation:

You should avoid using global variables in a program because global variables can be accessed by any part of the code  and every function or any part of the code has the tendency to alter or modify its value. One can't limit the scope or in other words one cant simply force any part of the program not to use them or  modify it's values. Testing of large programs also becomes difficult as it is hard to keep track of the functions reading and modifying the values of global variables

You might be interested in
write a c++program that allows the user to enter the last names of fivecandidates in a local election and the number of votes re
madreJ [45]

Answer:

#include<iostream>

#include<stdlib.h>

using namespace std;

int main(){

   //initialization

   string str1[5];

   int arr_Vote[5];

   int Total_Vote=0,max1_Index;

   int max1=INT_MIN;

   //loop for storing input enter by user

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

       cout<<"Enter the last name of candidate: "<<endl;

       cin>>str1[i];

       cout<<"Enter the number of vote receive by the candidate: "<<endl;

       cin>>arr_Vote[i];

       //calculate the sum

       Total_Vote = Total_Vote + arr_Vote[i];

       //find the index of maximum vote

       if(arr_Vote[i]>max1){

           max1=arr_Vote[i];

           max1_Index=i;

       }

   }

   //display

   cout<<"\nThe output is......"<<endl;

   //loop for display data of each candidate

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

       cout<<str1[i]<<"\t"<<arr_Vote[i]<<"\t"     <<float(arr_Vote[i]*100)/Total_Vote<<"%"<<endl;

   }

   //display winner

   cout<<"The winner candidate is"<<endl;

   cout<<str1[max1_Index]<<"\t"<<arr_Vote[max1_Index]<<"\t"<<float(arr_Vote[max1_Index]*100)/Total_Vote<<" %"<<endl;

}

Explanation:

Create the main function and declare the two arrays and variables.

the first array for storing the names, so it must be a string type. second array stores the votes, so it must be int type.

after that, take a for loop and it runs for 5 times and storing the values entered by the user in the arrays.

we also calculate the sum by adding the array data one by one.

In the same loop, we also find the index of the maximum vote. take an if statement and it checks the element in the array is greater than the max1 variable. Max1 variable contains the very small value INT_MIN.

If condition true, update the max1 value and update the max1_Index value.

The above process continues for each candidate for 5 times.

After that, take a for loop and display the data along with percentage by using the formula:

Vote\,percent=\frac{Vote\,receive*100}{Total\,vote}

the, finally display the winner by using the max1_Index value.  

5 0
3 years ago
A table with a width set to 600 pixels will look ________ on a monitor with resolution set to 640 × 480 than on a monitor with r
egoroff_w [7]
There are no options.

It would, however, look larger.
3 0
3 years ago
0111101101010110101110110001001011101001011101101010101010110101
rodikova [14]

Answer:

binary digits in computer system it belongs

4 0
3 years ago
What kind of software consists of programs designed to make users more productive and/or assist them with personal tasks?
Sunny_sXe [5.5K]
It is application software
6 0
3 years ago
The function below takes a single string parameter: sentence. Complete the function to return everything but the middle 10 chara
dolphi86 [110]

Answer:

def get_middle_ten(sentence):

   ind = (len(sentence) - 12) // 2

   return sentence[ind:ind + 12]

# Testing the function here. ignore/remove the code below if not required

print(get_middle_twelve("abcdefghijkl"))

print(get_middle_twelve("abcdefghijklmnopqr"))

print(get_middle_twelve("abcdefghijklmnopqrst"))

7 0
3 years ago
Other questions:
  • Numeric data is stored in ___________ for direct processing.
    10·2 answers
  • Savings accounts typically offer more interest than what
    10·1 answer
  • A university wants to install a client-server network. Which feature do you think is important for them as they set up the netwo
    7·1 answer
  • What does the presence of the cydia app on an ios device indicate?
    14·1 answer
  • What fields of engineering are in Biomedical
    7·1 answer
  • What are the three uses of a screw?​
    13·2 answers
  • Write a method named isNumericPalindrome that accepts an integer parameter named num. If num is a palindrome the method must ret
    6·1 answer
  • Taylor and Rory are hosting a party. They sent out invitations, and each one collected responses into dictionaries, with names o
    9·1 answer
  • Question is in photo
    11·1 answer
  • A researcher is interested in learning more about the different kinds of plants growing in different areas of the state she live
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!