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
Blender questions
Tamiku [17]
<span>14. A mesh represents a(n) _____ object if its faces enclose a positive and finite amount of space. (1 point)

odd

connected

simple

convex



15. Which of the following is the 3-D view port? (1 point)

the standard layout used for new files

the polygon viewing on the default screen

straight line segments connecting two vertices

a single static image in 3-D

The answer for number 1, should be:
SOLID
</span><span>A mesh represents a solid object if its faces enclose a positive and finite amount of space
</span>
The answer for the second question is:
a single static image in 3-D
4 0
3 years ago
Read 2 more answers
Brainliest Answer!!
olganol [36]
The answer to your question is true
6 0
3 years ago
Read 2 more answers
What does ADSL stand for?
vladimir1956 [14]
Asymmetric digital subscriber line (ADSL)
3 0
4 years ago
Read 2 more answers
Driving is expensive. Write a program with a car's miles/gallon and gas dollars/gallon (both doubles) as input, and output the g
zepelin [54]

Answer:

Explanation:

The following is written in C++ and asks the user for inputs in both miles/gallon and dollars/gallon and then calculates the gas cost for the requested mileages using the input values

#include <iostream>

#include <iomanip>

using namespace std;

int main () {

   // distance in miles

   float distance1 = 20.0, distance2 = 75.0, distance3 = 500.0;

   float miles_gallon, dollars_gallon;

   cout << "Enter cars miles/gallon: "; cin >> miles_gallon;

   cout << "Enter cars dollars/gallon: "; cin >> dollars_gallon;

   cout << "the gas cost for " << distance1 << " miles is " << fixed << setprecision(2) << (float) dollars_gallon * distance1 / miles_gallon << "$\n";

   cout << "the gas cost for " << distance2 << " miles is " << fixed << setprecision(2) << (float) dollars_gallon * distance2 / miles_gallon << "$\n";

   cout << "the gas cost for " << distance3 << " miles is " << fixed << setprecision(2) << (float) dollars_gallon * distance3 / miles_gallon << "$\n";

   return 0;

}

8 0
3 years ago
Read the following scenarios carefully and select a suitable storage device for each situation. Make sure to justify your choice
labwork [276]

Answer:

SSD drive or sd card

Explanation:

Optical wouldn't have enough data and could get easily damaged by the movement of the armed forces.Hard Drives would be insanely bad as if you even slightly moved while it were moving you would corrupt data. SSD doesn't get damaged as easily as these two and can hold a sufficient amount of data for its size.

8 0
3 years ago
Other questions:
  • Point mode allows you to select cells for use in a formula by using your finger or the pointer
    7·1 answer
  • Which of the following tasks is least effective at preventing a computer virus?
    14·2 answers
  • What is an activity that can help you enhance the appearance of your computer’s desktop?
    13·1 answer
  • Wap to input any multi digits number and display the sum of odd digits and even digits​
    5·1 answer
  • Light is a key formal element that film artists and technicians carefully manipulate to create mood, reveal character, and conve
    15·1 answer
  • _____________ describes the abstraction of web-based computers, resources, and services that system developers can utilize to im
    12·1 answer
  • Ann wants to save her presentation so she can work on it later. Which device on her computer can store this data long term?
    15·2 answers
  • HELP PLSSS I WILL MARK U!!!!
    10·2 answers
  • How is a secure HTTP (HTTPS) different from a non-secured HTTP?
    15·1 answer
  • Select the skill that matches the following definition.​
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!