Write a program to repeatedly read integers from the standard input until it reads "-1" and exits. For each number before "-1," if it is positive and odd, do the following:

Answers

Answer 1

Answer:

#include <stdio.h>  

int main() {  

int p=0, n=0, z=0, inp=0;  

printf("How do I write a C program to read numbers until -1 "  

 "is encountered and also count the number of positive, negative, "  

 "zeroes encountered by users using a while loop?\n\n\n");  

printf("Enter an integer  (-1 to quit): ");  

scanf("%d",&inp);  

while(inp != -1) {  

 if(inp > 0) p++;  

 else if(inp < 0) n++;  

 else z++;  

 printf("\nEnter next integer (-1 to quit): ");  

 scanf("%d",&inp);  

}  

n++; /* -1 is also a -ve number */  

printf("You have entered ...\n");  

printf("\t\tPositive numbers: %d\n",p);  

printf("\t\tNegative numbers: %d\n",n);  

printf("\t\t          Zeroes: %d\n",z);  

}

Explanation:


Related Questions

What type of system software manages memory?

Answers

Answer:

"Operating System"

Explanation:

The type of system software that manages memory is an operating system. To manage memory, the operating system employs a number of software strategies.

What is system software?

The most crucial piece of software that runs on a computer is the operating system. It controls the memory, operations, software, and hardware of the computer.

You can converse with the computer using this method even if you don't understand its language. Memory connections are the structures that come before and after all memory areas, whether they are allocated or available.

Working memory, short-term memory, and long-term memory are the three primary categories of memory. While long-term memory stores your enduring memories, working memory and short-term memory enable you to retain and use transient information.

Therefore, an operating system is a sort of system software that controls memory.

To learn more about system software, refer to the link:

https://brainly.com/question/12908197

#SPJ2

True or False: VLANs in cloud computing are most likely to be found on direct connections with a CSP.
O True
O False

Answers

Based on computing network operation, it is false that VLANs in cloud computing are most likely to be found on direct connections with a CSP.

What is VLAN?

VLAN is an acronym of Virtual Local Area Network that establishes its broadcast domain which enables network admins to combine hosts regardless the hosts are connected on the same network switch or not.

Given that the VLAN created its broadcast domain, you are likely not found it on direct connections with a CSP.

Hence, in this case, it is concluded that the correct answer is False.

Learn more about VLAN here: https://brainly.com/question/6769174

Apart from using secure networks, how else can Dhruv keep his deliverables safe in the office and on the go? Select all that apply.

Answers

It should be noted that data can be secured when working in the following way:

Establishing a cyber security policy.Using two-factor authentication.Keeping passwords strong.Using secure internet connections.

Your information is incomplete. Therefore, an overview relating to the topic will be given. It should be noted that as telecommuting becomes a standard practice, the challenge regarding data security increases.

Employers should educate their employees about data security. The workers should know that data security is a priority and that all the internet connections are secure.

Learn more about data security on:

https://brainly.com/question/10091405

Please hurry, it's a test! 30 POINTS. :)
What computing and payment model does cloud computing follow?

Cloud computing allows users to_____ computing resources and follows the ______
payment model.

1. Buy, Own, Rent, Sell
2. pay-as-you-go, pay-anytime-anywhere, pay-once-use-multiple-times

Answers

1 own
2 pay anytime anywhere

When using wildcards and the matching case option, which of the following would not be found by entering on in the Find dialog box?
1. den
2. down
3.Dayton
4. documentation

Answers

There are different types of Wildcard. The option that would not be found by entering on in the Find dialog box is called  Dayton.

Wildcard  is commonly known wild character or wildcard character. It is known as a symbol that is often used in place of or to stand for one or more characters.

Some wildcards are;

The asterisk (*)The question mark (?) Percent ( % )

Wildcards are said to be universally used. Dayton cannot be found because it is not a wildcard but a name of a person.

Learn more about Wildcard  from

https://brainly.com/question/7380462

What was the main limitation of computer networking that the invention of the Robert website of the 1990s

Answers

Answer:

The TCP/IP protocol could only be used in universities, governments, and businesses. People around the world could not send data to one another.


Which statement, if any, about Boolean is false?
a. They are all true.
b. Boolean is one of the four data types.
c. All expressions in python have a Boolean value.
c. The Boolean values are True and False.

Answers

Answer:

A.

Explanation:

What is it called when a unique letter is assigned to a shared drive

Answers

Answer:

Assigning a drive letter to a network drive is called mapping the drive, or linking the drive, by network nerds.

Explanation:

In the context of the data administration component of a database management system (DBMS), the acronym CRUD stands for _____.

Answers

CRUD is an acronym in database management system (DBMS) that stands for Create, Read, Update, and Delete.

CRUD is an acronym in database management system (DBMS) that stands for Create, Read, Update, and Delete. It is the four basic functions of persistent storage.

CRUD operations are foundation operations every database developer and administrator needs to understand.

Find out more on CRUD at: https://brainly.com/question/651396

Write a program that reads the student information from a tab separated values (tsv) file. The program then creates a text file that records the course grades of the students. Each row of the tsv file contains the Last Name, First Name, Midterm1 score, Midterm2 score, and the Final score of a student. A sample of the student information is provided in StudentInfo.tsv. Assume the number of students is at least 1 and at most 20.
The program performs the following tasks:
Read the file name of the tsv file from the user.
Open the tsv file and read the student information.
Compute the average exam score of each student.
Assign a letter grade to each student based on the average exam score in the following scale:
A: 90 = < X o
B: 80 = < x < 90
C: 70 = < X < 80
D: 60 = < x < 70
E: X < 60
• Compute the average of each exam.
• Output the last names, first names, exam scores, and letter grades of the students into a text file named report.txt. Output one student per row and separate the values with a tab character.
• Output the average of each exam, with two digits after the decimal point, at the end of report.txt. Hint: Use the setprecision manipulator to format the output.
Ex: If the input of the program is:
StudentInfo.tsv
and the contents of StudentInfo.tsv are: 70 45 59
Barrett Edan 96 97 88
Bradshaw Reagan 73 94 80
Charlton Caius 88 61 36
Mayo Tyrese 90 86 45
the file report txt should contain
Barrett Edan 70 45 59 F
Baadha Boagan 9e 157 89 A
Charlton Caius 73 94 80 B
Mayo and Tyrese 58 61 36 D
Stern and Brenda 90 36 45 C
Average midterm 83.40, midterm2 76.60, final 61.60

Answers

#include
#include
#include
#include
#include
#include


using namespace std;

// Class student required to store the data
class Student{
public:
string lname;
string fname;
int marks[3];
char grade;

// Function which generates the grade for student
void calculate_grade(){
double sum = 0;
for(int i=0;i<3;i++){
sum+= marks[i];
}
double average = sum/3;
if(average>=90 && average<100)
this->grade = 'A';
else if(average>=80)
this->grade = 'B';
else if(average>=70)
this->grade = 'C';
else if(average>=60)
this->grade= 'D';
else this->grade = 'F';
}
};

// This function reads the file , and creates a vector of Students data
vector read_file(string fileName){

// Opening the file
fstream fin;
fin.open(fileName);


// Temp variables
vector list;
vector row ;
string line, word, temp;

// Read the data into vector
while(getline(fin,line)){
row.clear();
stringstream s(line);

while(getline(s,word,'\t')){

row.push_back(word);

}
Student st;
st.fname = row[0];
st.lname = row[1];
st.marks[0] = stoi(row[2]);
st.marks[1] = stoi(row[3]);
st.marks[2] = stoi(row[4]);
st.calculate_grade();
list.push_back(st);
}
fin.close();
return list;
}

// This function takes filname to be output as input, and list of student
void writeFile(string filename, vector list){

// Opening the new file
ofstream fin(filename);
for(int i=0;i string line = list[i].fname+"\t"+list[i].lname+"\t"+to_string(list[i].marks[0])+"\t"
+to_string(list[i].marks[1])+"\t"+to_string(list[i].marks[2])+"\t"+list[i].grade+"\n";
fin<
}


// Find the stats required
double average1 =0,average2 =0 ,average3 = 0;
for(int i=0;i average1+=list[i].marks[0];
average2+=list[i].marks[1];
average3+=list[i].marks[2];
}
average1/=list.size();
average2/=list.size();
average3/=list.size();

// Writting the stats
fin<<"\n"<<"Average: "<<"mid_term1 "<
// Closing the file
fin.close();
}
int main(){

// Taking the input
cout<<"Enter the filename: ";
string filename;
cin>>filename;
vector list;

// Reading and Writting to the file
list = read_file(filename);
writeFile("report.txt",list);


}

In this exercise we have to use the knowledge of the JAVA language to write the code, so we have to:

The code is in the attached photo.

So to make it easier the code can be found at:

using namespace std;

// Class student required to store the data

class Student{

public:

string lname;

string fname;

int marks[3];

char grade;

// Function which generates the grade for student

void calculate_grade(){

double sum = 0;

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

sum+= marks[i];

}

double average = sum/3;

if(average>=90 && average<100)

this->grade = 'A';

else if(average>=80)

this->grade = 'B';

else if(average>=70)

this->grade = 'C';

else if(average>=60)

this->grade= 'D';

else this->grade = 'F';

}

};

// This function reads the file , and creates a vector of Students data

vector read_file(string fileName){

// Opening the file

fstream fin;

fin.open(fileName);

// Temp variables

vector list;

vector row ;

string line, word, temp;

// Read the data into vector

while(getline(fin,line)){

row.clear();

stringstream s(line);

while(getline(s,word,'\t')){

row.push_back(word);

}

Student st;

st.fname = row[0];

st.lname = row[1];

st.marks[0] = stoi(row[2]);

st.marks[1] = stoi(row[3]);

st.marks[2] = stoi(row[4]);

st.calculate_grade();

list.push_back(st);

}

fin.close();

return list;

}

// This function takes filname to be output as input, and list of student

void writeFile(string filename, vector list){

// Opening the new file

ofstream fin(filename);

for(int i=0;i string line = list[i].fname+"\t"+list[i].lname+"\t"+to_string(list[i].marks[0])+"\t"

+to_string(list[i].marks[1])+"\t"+to_string(list[i].marks[2])+"\t"+list[i].grade+"\n";

fin<

}

// Find the stats required

double average1 =0,average2 =0 ,average3 = 0;

for(int i=0;i average1+=list[i].marks[0];

average2+=list[i].marks[1];

average3+=list[i].marks[2];

}

average1/=list.size();

average2/=list.size();

average3/=list.size();

// Writting the stats

fin<<"\n"<<"Average: "<<"mid_term1 "<

// Closing the file

fin.close();

}

int main(){

// Taking the input

cout<<"Enter the filename: ";

string filename;

cin>>filename;

vector list;

// Reading and Writting to the file

list = read_file(filename);

writeFile("report.txt",list);

}

See more about JAVA at brainly.com/question/2266606

Tim Berners-Lee cultivated a way to interconnect and self-index data. He made a major contribution to the development of the Internet by creating _____.
A. graphic data
B. emoticons
C. the hyperlink
D. digital data

Answers

Answer: D. Digital data

A(n) __________ is a system where banks in the United States eventually figured out that they could print more __________ than the gold that they had in their vaults.

Answers

Based on the information given regarding money, the correct option will be fractional reserve; paper money.

It should be noted that in the United States, there are banking institutions that hold reserves which is simply the fraction of deposits of other banks.

The fractional reserve is equal to the fraction of the bank's deposit liabilities that are owed to customers.

Therefore, a fractional reserve is a system where banks in the United States eventually figured out that they could print more paper money than the gold that they had in their vaults.

Learn more about money on:

https://brainly.com/question/24556197

what does PR stand for ?

Answers

Answer:

Public Relations or Pull Request (computer programming)

Explanation:

Hope this helps



List and explain three ways study groups benefit your learning.

Answers

Answer:

Studying in groups can have many effective outcomes and be beneficial. Here are some ways studying in a group is benefical,

1.  More support, limits chances of procrastination

     With many people, everyone is assigned a role or there is more determination by all peoples to get the work done than an individual being the only one responsible than many trying to accomplish the completion of the project.

2. More people means more parts can get done effectively and taking notes is easier.

     More people allow the work (depending on the project of assignment) for the work to get more focused and worked on faster with the designated roles given.

3. More interactive and allows (sometimes an enjoyable times) and to even learn faster than independently.

      People, not all however, might like the company, there's support and even people skills is enhanced by being in the group.

Which meter would you use to determine which lamp is defective in the shortest possible time? Explain how you would use this meter and why.

Answers

Answer:

bla bla bla bla

Explanation:

I dont anther stand

seven characteristics of information ​

Answers

Answer:

1.Accuracy and Precision.

2.Legitimacy and Validity.

3.Reliability and Consistency.

4.Timeliness and Relevance.

5.Completeness and Comprehensiveness.

6.Availability and Accessibility.

7.Granularity and Uniqueness.

Explanation:

#carry on learning

When defining a system
landscape, the following are all
necessary to operate the ERP
system,
except
Select one:
O a. Techincal expertise.
O b. Computer hardware.
O c. Networking hardware.
O d. None of the above.
O e. All of the above.

Answers

All of the given answer options are necessary to operate the enterprise resource planning (ERP) system when defining a system  landscape.

Enterprise resource planning (ERP) can be defined as a business strategy process through which business firms manage and integrate the main parts of their day-to-day business activities by using software applications.

The main objective and purpose of an enterprise resource planning (ERP) system is to significantly reduce costs by integrating all the operations of a business firm.

In Computer science, when defining a system  landscape, all of the following are necessary to operate the enterprise resource planning (ERP) system:

Technical expertiseComputer hardwareNetworking hardware

Read more on ERP system here: https://brainly.com/question/25752641

x = 9 % 2

if (x == 1):
  print ("ONE")
else:
  print ("TWO")

Answers

The output will be : ONE

Answer:

Hewo There!!

_______________________

Simplify  9 %  ⋅  2 .

x = 0.18

_______________________

“One’s life has value so long as one attributes value to the life of others, by means of love, friendship, indignation and compassion.” — Simone De Beauvoir

_______________________

Think of life as a mytery because well it sort of is! You don't know what may happen may be good or bad but be a little curious and get ready for whatever comes your way!! ~Ashlynn

what was the pascaline used for?​

Answers

Answer:

Math like multiplication, addition, division, and subtraction

what is office course
how to learn office course

Answers

Answer:

It includes Word, to create, polish, and share documents; Excel, to analyze and visualize data; PowerPoint, to create, collaborate, and effectively present ideas; OneNote, to organize ideas into a digital notebook; Outlook, to organize email, coordinate schedules, and stay up to date with contacts; Access, to create .

Hope this helps you XD ✌️

how to download film​

Answers

Which film are you talking about?
what film are you trying to download from

Implement a class named BankAccount. Every bank account has a starting balance of $0.00. The class should implement methods to accept deposits and make withdrawals. __init__(self): Sets the balance to 0. deposit(self, amount): Deposits money. Return True if transaction is successful. Return False if amount is less than 0 and ignore the transaction. widthdraw(self, amount): Withdraws money. Return True if transaction is successful. Return False if amount is more than the balance and ignore the transaction.

Answers

The BankAccount class implementation in Python 3.8 is found in the attached image

The deposit method  uses an if statement to check if the amount to be deposited is negative. If so, it does nothing, but returns False signifying that the transaction failed.

However, if the test finds out that the amount to deposit is positive or zero, the deposit method increments the balance, then returns True, signifying a successful transaction.

The withdraw method is similar, but this time, it tests if the amount to be withdrawn is greater than the available balance. If so, it ignores the transaction, and returns False.

If the withdrawal amount is less or equal to the available balance, the withdraw method decrements the available balance, then returns True, signifying a successful transaction.

Learn more about Python programming here https://brainly.com/question/20379340

During boom times, which of the
following is true?
A. less tax revenue is being paid by businesses
B. less tax revenue is being paid by consumers
C. more tax revenue is being collected from businesses
and consumers
D. tax increases are causing unemployment and job
loss

Answers

During boom times, the option that was true is that less tax revenue is being paid by businesses.

How does the taxation system can boom a economy?

The use of taxation is one that affect incentives, as taxes can influence supply and demand factors.

Note that by lowering marginal tax rates on wages and salaries, can bring about the zeal for people to work more and earn more.

Therefore, During boom times, the option that was true is that less tax revenue is being paid by businesses.

Learn more about  boom times from

https://brainly.com/question/26020324

#SPJ2

"""
Multiply.py - This program prints the numbers 0 through 10 along
with these values multiplied by 2 and by 10.
Input: None.
Output: Prints the numbers 0 through 10 along with their values multiplied by
2 and by 10.
"""
head1 = "Number: "
head2 = "Multiplied by 2: "
head3 = "Multiplied by 10: "
NUM_LOOPS = 10 # Constant used to control loop.
print("0 through 10 multiplied by 2 and by 10" + "\n")
# Initialize loop control variable.
# Write your counter controlled while loop here
# Multiply by 10.
# Multiply by 2.
print(head1 + str(numberCounter))
print(head2 + str(byTwo))
print(head3 + str(byTen))
# Next number.
Summary
In this lab, you use a counter-controlled while loop in a Python program. When completed, the program should print the numbers 0 through 10, along with their values multiplied by 2 and by 10. The data file contains the necessary variable declarations and output statements.
Instructions
Make sure the file Multiply.py is selected and opened.
Write a counter-controlled while loop that uses the loop control variable (numberCounter) to take on the values 0 through 10.
In the body of the loop, multiply the value of the loop control variable by 2 and by 10. Remember to change the value of the loop control variable in the body of the loop.
Execute the program by clicking the "Run Code" button at the bottom of the screen.

Answers


head1 = "Number: "
head2 = "Multiplied by 2: "
head3 = "Multiplied by 10: "
NUM_LOOPS = 10 # Constant used to control loop.

print("0 through 10 multiplied by 2 and by 10" + "\n")

# Initialize loop control variable.
# Write your counter controlled while loop here
# Multiply by 10.
# Multiply by 2.
x = 0
while(x<11):
print(head1 + str(x))
print(head2 + str(x*2))
print(head3 + str(x*10))
x += 1
# Next number.

please write an Introduction on intrusion detection system and prevention system
PLEASE

Answers

Answer:

An Intrusion Detection System (IDS) is a system that monitors network traffic for suspicious activity and issues alerts when such activity is discovered. It is a software application that scans a network or a system for harmful activity or policy breaching. Any malicious venture or violation is normally reported either to an administrator or collected centrally using a security information and event management (SIEM) system. A SIEM system integrates outputs from multiple sources and uses alarm filtering techniques to differentiate malicious activity from false alarms.

write a short paragraph (three to four sentences) that explains how it works for computers and internet communications in relation to cybersecurity.

Answers

Answer:

Public and private keys form the basis for public key cryptography, also known as asymmetric cryptography. In public key cryptography, every public key corresponds to only one private key. Together, they are used to encrypt and decrypt messages. If you encode a message using a person’s public key, they can decode it using their matching private key.

Explanation:

Change up the wording.

Consider the following declaration:
String s = "cat";
Which of the following statements assigns the number of characters in s to k?

A. int k = s.length;
B. int k = s.length();
C. int k = s.size;
D. int k = s.size();

Consider the following declarations:
String s1 = "apple";
String s2 = "apple";
What is the result of s1.compareTo(s2)?

A. true
B. false
C. 0
D. 1

Consider the following declarations:
String s1 = "apple";
String s2 = "APPLE";
Which of the following expressions is true?

A. s1.equals(s2) && s1.equalsIgnoreCase(s2)
B. !s1.equals(s2) && s1.equalsIgnoreCase(s2)
C. s1.equals(s2) && !s1.equalsIgnoreCase(s2)
D. !s1.equals(s2) && !s1.equalsIgnoreCase(s2)

Answers

Answer:

B, C, B

Explanation:

According to my understanding of these questions, these are in Java.

For the first one, there is a built in function called .length() for a string, so it's answer B.

For the second one, this should come out as C, 0 since compareTo compares the ascii values of the characters.

The third one's answer should be B. s1.equals(s2) for characters that are caps and not caps comes out with false, so ! would negate it. s1.equalsIgnoreCase(s2) would come out as true, ignoring the cases of APPLE.

what is the relationship between interrupt and buffer

Answers

Answer:

Operating systems have some code called an 'interrupt handler', which prioritises the interrupts and saves them in a queue. Buffers are used in computers as a temporary memory area, and they are essential in modern computers because hardware devices operate at much slower speeds than the processor.

challenge encountered ​

Answers

Answer:

What challenge?

Explanation:

So has anyone opened the link/file those people are giving out as answers? Like what are they, viruses, answers, nothing??? Someone that has opened one tells me what it was and what happened because I am to scared to open it.

Answers

Answer:

They're viruses that why they answer so quick and get deleted quickly

Other Questions
You invest $4,300 in an account that pays you an interest rate of 8.5%, compounded continuously. Calculate the balance of your account after 10 years. Round your answer to the nearest hundredth. What Contributions did Captain John Parker do during the revolution? 6 Contributions. At the bakery shop, each baker works at his or her own speed, making the same number of cakes each day. Marissa makes 28 cakes in 2 weeks, Carlos makes 60 cakes in 20 days, and Shelby makes 5 cakes in 2 days.When the shop owner graphs the relationship between the number of cakes made and days, who has the steepest graph? Explain. Solve the inequality:12+x3(x-6) Match each logical fallacy or distortion to its correct definition. Use a calculator to solve this question. This cube has volume 50cm cube. Work out the length of the side of the cube to 2 dp. Need help please and thank you. When a hurricane approaches land, people living directly on thecoast should always evacuate when told to do so by authorities. what does x equal? 3/4(x+21)=10 1/2 Ramses became powerful by fighting his enemy to the north, the...a. Romansb. GreeksHittitesAssyrians Describe the slope of the line with the equationy = -4x + 10.A: positive slopeB: negative slopeC: zeroD: undefined what is the value of the 4 in the number 546210? give your anwer in words 1.0.2217.9-(4.1 + 1.8)] -0.22+ [7.9 - 0.224 need the answer right now carbon dioxide or carbon monoxide is a compound whose molecules consist of one atom of carbon and two atoms of oxygen Who supported the Greensboro Four Which of the following is a key strategy for nutrition coaching?. PLEASE HELP WILL GIVE BRAINLIEST AND 30 POINTS!!!!!This is an assignment in Algebra 1 discussing growth and decay. Specifically car depreciation. Over the years car's prices go down. I basically had to calculate the percentage of how much this car's price dropped. So I calculated what it dropped every year now I need to do every month but I'm not sure how to do that. First pic: the annual rate Second pic: my annual rate calculations/percentagesThird pic: what I have so far for the monthly rate but its all wrong because my calculations don't match up but I think it's close Evaluate - 1 - ( - z ) where z = -2 which group best describes the changes that took place after the end of the great war?Group A: Women adopted shorter, less restrictive clothes. Musicians experimented with new forms. Church attendance declined in Europe. People flocked to the movies.Groups B: Women adopted more somber clothes. Classical music enjoyed a great resurgence. Church attendance soared in Europe. People used their leisure time to get fit. XMultiply by takingMultiply.20 X 600Stuck? Review related articles/videos or use a hint.