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
Alexxandr [17]
3 years ago
14

What's the problem with this code ?

Computers and Technology
1 answer:
Svet_ta [14]3 years ago
4 0
Hi,

I changed your program using some of the concepts you were trying to use. Hopefully you can see how it works:

#include <string>
#include <iostream>
#include <sstream>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
   short T;
   cin >> T;
   cin.ignore();

   string str[100];

   for(int i=0; i<T; i++)
   {
      getline(cin, str[i]);
   }

   for (int i = 0; i < T; i++)
   {
      stringstream ss(str[i]);
      string tmp;
      vector<string> v;

      while (ss >> tmp)
      {
          // Let's capitalize it before storing in the vector
          if (!tmp.empty())
          {
              transform(begin(tmp), end(tmp), std::begin(tmp), ::tolower);
              tmp[0] = toupper(tmp[0]);
           }
           v.push_back(tmp);
        }

        if (v.size() == 1)
        {
           cout << v[0] << endl;
        }
        else if (v.size() == 2)
        {
           cout << v[0][0] << ". "  << v[1] << endl;
        }
        else
        {
            cout << v[0][0] << ". " << v[1][0] << ". " << v[2] << endl;
        }
    }

     return 0;
}

You might be interested in
Which is a circuit board located behind an LCD screen on a laptop?
mina [271]

Answer:

Inverter is an electronic circuit that is located behind the LCD screen on a laptop.

Explanation:

Inverter is an electronic device that is used to convert DC voltage into AC voltage. This will lead to control the output power that is required to Liquid Crystal display. The Output power is limit up to the requirement of Florescent light that are used in Liquid crystal display to make picture visible.

This Inverter is just behind the LCD in laptop to control the lights on the display of screen.

4 0
3 years ago
The OSI model is currently the most widely implemented network model used to develop and build networks of any size, including t
natta225 [31]

Answer:

The correct answer to the following question will be "False".

Explanation:

  • The Open Systems Interconnection model is a conceptualization that describes and vastly simplifies a telecommunication or computer system's communication features, regardless of its inner structure and technologies underlying them.
  • This model aims is to direct manufacturers and creators so that they would modularize with the digital communication devices and computer programs they build, and to promote a consistent context that defines the roles of a network or telecom device.

Therefore, the given statement is false.

7 0
2 years ago
What's the difference between kilobyte and kibibyte, and why was the IEC convention for computer international memories made???
Masja [62]

Answer:

The Kibibyte was developed to take place of the kilobytes in the computer science context where the Kilobyte stands for 1024 bytes. And the Kilobyte interpretation to mean 1024 bytes, conflicts the Standard definition of the prefix kilo or 1000. And the IEC convention for computer international memories was made to define the international standards for electrical, electronic and related technologies.

Explanation:

Please check the answer section.

8 0
3 years ago
What is the digital divide? What does the digital divide mean for the world?
Luda [366]

it mean for some people that have technology like a computer and there are some who don't have access to technology like phones, and tv's

8 0
3 years ago
What is a limitation of the flash memory card select one of the options below as your answer:
Inga [223]
The answer is C. You can only use it with the correct memory card reader.
4 0
3 years ago
Other questions:
  • jason works for a restaurant that serves only organic local produced what trend is this business following?
    6·2 answers
  • 3. The term integration refers to the ability to
    6·1 answer
  • Bulldog Holdings is a U.S.-based consumer electronics company. It owns smaller firms in Japan and Taiwan where most of its cell
    5·1 answer
  • ______allow you to select elements that are in a certain state, such as when the mouse if hovering over an element
    14·1 answer
  • Does anyone know any good new online multiplayer console games that are either out or coming out soon.
    7·1 answer
  • In python, Create a conditional expression that evaluates to string "negative" if user_val is less than 0, and "non-negative" ot
    12·1 answer
  • Under the Home tab, controls for aligning text and objects can be found in the
    5·2 answers
  • State the functions of the parts of the computer​
    11·2 answers
  • Define technical writing. The proposal introduces the ……. (5 Mark)
    9·1 answer
  • This method of file transfer has been used for decades and is frequently used for uploading changes to a website hosted by an in
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!