subject

Write a loop that reads strings from standard input where the string is either "land", "air", or "water". The loop terminates when "" (five x characters) is read in. Other strings are ignored. After the loop, your code should print out 3 lines: the first consisting of the string "land:" followed by the number of "land" strings read in, the second consisting of the string "air:" followed by the number of "air" strings read in, and the third consisting of the string "water:" followed by the number of "water" strings read in. Each of these should be printed on a separate line.

This is what I have so far.
char land, air, water;
int l, a, w, j;

land = 'l';
air = 'a';
water = 'w';

l = 0, a = 0, w = 0;

cin>> j;

if (j = land, l = l + 1)
{
cout<< "Land";
}
if (j = air, a = a + 1)
{
cout<< "Air";
}
if (j = water, w = w + 1)
{
cout<< "Water";

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 16:30
Which of the following statements best describes it careers?
Answers: 2
question
Computers and Technology, 23.06.2019 09:30
The place where the extended axis of the earth would touch the celestial sphere is called the celestial
Answers: 1
question
Computers and Technology, 23.06.2019 11:00
This chapter lists many ways in which becoming computer literate is beneficial. think about what your life will be like once you’re started in your career. what areas of computing will be most important for you to understand? how would an understanding of computer hardware and software you in working from home, working with groups in other countries and contributing your talents.
Answers: 1
question
Computers and Technology, 23.06.2019 12:10
2. fabulously fit offers memberships for$35 per month plus a $50 enrollmentfee. the fitness studio offersmemberships for $40 per month plus a$35 enrollment fee. in how many monthswill the fitness clubs cost the same? what will the cost be?
Answers: 1
You know the right answer?
Write a loop that reads strings from standard input where the string is either "land", "air", or "wa...
Questions
question
Biology, 16.12.2020 08:40
question
Mathematics, 16.12.2020 08:40
Questions on the website: 13722360