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
What are the five types of pointing devices?
choli [55]

Answer:

mouse, track ball, stick, touch pad, tablet

6 0
3 years ago
In the circuit seen here, the resistor has a resistance of 3 ohms. If no change in the battery size occurs, what will happen to
Rufina [12.5K]

It will increase by a factor of 2

6 0
3 years ago
Read 2 more answers
What project started the development of inter-network connections using tcp/ip that has evolved into the internet today.?
rosijanka [135]
Dial Up, help start it
3 0
3 years ago
COULD U ANSWER THIS ???
vladimir1956 [14]

Answer:

B.lightning striking a tree

Explanation:

The crowd dispersing in all directions is not a closed-loop by any means, and students jogging around an oval track as well is not a closed-loop, and also not a cross country run from one point to another. However, the lightning striking a tree is a closed loop that best models a circuit. And as lightning strikes the tree, like a closed circuit, tree catches the fire, or in circuitry words, the current is generated, and tree catches the fire due to it, just like bulb starts glowing.

3 0
3 years ago
A large gambling company needs to be able to accept high volumes of customer wagers within short timeframes for high-profile spo
Dima020 [189]

Answer: A. a mobile app that only accepts wagers based on the user's location

Explanation:

Elastic cloud simply refers to the cloud computing offering which due to the need for change helps in the provision of variable service levels.

Based on the information given in the question, an effective elastic Cloud solution that can meet this client’s needs is a mobile app that only accepts wagers based on the user's location.

Since there are strict laws that prohibit gambling activities outside the licensed zones, the user location is vital in the mobile app.

5 0
3 years ago
Other questions:
  • A(n) ____________________ defines the number and type of daemons that are loaded into memory and executed by the kernel on a par
    12·1 answer
  • Kumar was working on his term paper and had not saved his work before the battery died on his laptop. He panics because the pape
    12·1 answer
  • Brittany just pulled up a database table with employee information that contains 50 records of employees at her company. Which o
    12·1 answer
  • Software obtained illegally is called open-source software. true / false
    15·1 answer
  • A trench is a narrow excavation in which the depth is greater than the width and the width does not exceed 15 feet. A. False B.
    13·2 answers
  • Please code this in c++
    10·1 answer
  • 75+ (43-54)<br> -12<br> 12<br> 41
    12·2 answers
  • Of the people working in concert with security teams to ensure data quality and protection, the head of information management i
    5·1 answer
  • Which marketing strategy is represented by advertisers paying for online display ads?
    8·1 answer
  • Consider the following code segment.
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!