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
ehidna [41]
3 years ago
5

Write a program that takes paragraph from the user and prints all unique words in that paragraph using strings in c++

Computers and Technology
1 answer:
Bezzdna [24]3 years ago
5 0

Answer:

void printUniquedWords(char filename[])

void printUniquedWords(char filename[]) {

void printUniquedWords(char filename[]) {     // Whatever your t.text file is

    fstream fs(filename);

    fstream fs(filename);   

    fstream fs(filename);       

    fstream fs(filename);           map<string, int> mp;

    fstream fs(filename);           map<string, int> mp;   

    fstream fs(filename);           map<string, int> mp;       // This serves to keep a record of the words

    string word;

    string word;     while (fs >> word)

    string word;     while (fs >> word)     {

    string word;     while (fs >> word)     {         // Verifies if this is the first time the word appears hence "unique word"

        if (!mp.count(word))

        if (!mp.count(word))             mp.insert(make_pair(word, 1));

        if (!mp.count(word))             mp.insert(make_pair(word, 1));         else

        if (!mp.count(word))             mp.insert(make_pair(word, 1));         else             mp[word]++;

        if (!mp.count(word))             mp.insert(make_pair(word, 1));         else             mp[word]++;     }

        if (!mp.count(word))             mp.insert(make_pair(word, 1));         else             mp[word]++;     }   

        if (!mp.count(word))             mp.insert(make_pair(word, 1));         else             mp[word]++;     }       fs.close();

        if (!mp.count(word))             mp.insert(make_pair(word, 1));         else             mp[word]++;     }       fs.close();   

        if (!mp.count(word))             mp.insert(make_pair(word, 1));         else             mp[word]++;     }       fs.close();       // Traverse map and print all words whose count

        if (!mp.count(word))             mp.insert(make_pair(word, 1));         else             mp[word]++;     }       fs.close();       // Traverse map and print all words whose count     //is 1

        if (!mp.count(word))             mp.insert(make_pair(word, 1));         else             mp[word]++;     }       fs.close();       // Traverse map and print all words whose count     //is 1     for (map<string, int> :: iterator p = mp.begin();

        if (!mp.count(word))             mp.insert(make_pair(word, 1));         else             mp[word]++;     }       fs.close();       // Traverse map and print all words whose count     //is 1     for (map<string, int> :: iterator p = mp.begin();          p != mp.end(); p++)

        if (!mp.count(word))             mp.insert(make_pair(word, 1));         else             mp[word]++;     }       fs.close();       // Traverse map and print all words whose count     //is 1     for (map<string, int> :: iterator p = mp.begin();          p != mp.end(); p++)     {

        if (!mp.count(word))             mp.insert(make_pair(word, 1));         else             mp[word]++;     }       fs.close();       // Traverse map and print all words whose count     //is 1     for (map<string, int> :: iterator p = mp.begin();          p != mp.end(); p++)     {         if (p->second == 1)

        if (!mp.count(word))             mp.insert(make_pair(word, 1));         else             mp[word]++;     }       fs.close();       // Traverse map and print all words whose count     //is 1     for (map<string, int> :: iterator p = mp.begin();          p != mp.end(); p++)     {         if (p->second == 1)             cout << p->first << endl;

        if (!mp.count(word))             mp.insert(make_pair(word, 1));         else             mp[word]++;     }       fs.close();       // Traverse map and print all words whose count     //is 1     for (map<string, int> :: iterator p = mp.begin();          p != mp.end(); p++)     {         if (p->second == 1)             cout << p->first << endl;     }

        if (!mp.count(word))             mp.insert(make_pair(word, 1));         else             mp[word]++;     }       fs.close();       // Traverse map and print all words whose count     //is 1     for (map<string, int> :: iterator p = mp.begin();          p != mp.end(); p++)     {         if (p->second == 1)             cout << p->first << endl;     } }

You might be interested in
3.26 LAB: Leap Year A year in the modern Gregorian Calendar consists of 365 days. In reality, the earth takes longer to rotate a
Tju [1.3M]

Answer:

year = int(input("Enter a year: "))

if (year % 4) == 0:

  if (year % 100) == 0:

      if (year % 400) == 0:

          print(str(year) + " - leap year")

      else:

          print(str(year) +" - not a leap year")

  else:

      print(str(year) + " - leap year")

else:

  print(str(year) + "- not a leap year")

Explanation:

*The code is in Python.

Ask the user to enter a year

Check if the <u>year mod 4</u> is 0 or not. If it is not 0, then the year is not a leap year. If it is 0 and if the <u>year mod 100</u> is not 0, then the year is a leap year. If the <u>year mod 100</u> is 0, also check if the <u>year mod 400</u> is 0 or not. If it is 0, then the year is a leap year. Otherwise, the year is not a leap year.

8 0
3 years ago
Read 2 more answers
The TechWorld goes on a fast pace, what do you think would be the solution to the growing amount of data being collected by the
Nuetrik [128]

The solution to the growing amount of data in software applications to have fully sustainable usage for customers is;

  • Development of a sustainable model for the future now requires data storage that is engineered to be lower power requirements, lower cooling requirements, and lower waste production.

<h3>Sustainable data storage and usage</h3>

The objective of Sustainable Data Storage Initiative is to spread awareness of the solutions that can reduce the environmental impact of high waste producing data centers.

The environmental impact of data infrastructure is growing as data workloads increase. Hence, building a sustainable model for the future now requires data storage that is engineered to be lower power requirements, lower cooling requirements, and lower waste production.

Read more on Sustainable data storage and usage;

brainly.com/question/24882256

7 0
2 years ago
For this exercise, we are going to take a look at an alternate Calculator class, but this one is broken. There are several scope
vekshin1

Answer:

public class Calculator {

   private int total;

   private int value;

   

   public Calculator(int startingValue){

       // no need to create a new total variable here, we need to set to the our instance total variable

       total = startingValue;

       value = 0;

   }

   public int add(int value){

       //same here, no need to create a new total variable. We need to add the value to the instance total variable

       total = total + value;

       return total;

   }

   /**

   * Adds the instance variable value to the total

   */

   public int add(){

       // no need to create a new total variable. We need to add the value to the instance total variable

       total += value;

       return total;

   }

   public int multiple(int value){

       // no need to create a new total variable. We need to multiply the instance total variable by value.

       total *= value;

       return total;

   }

   //We need to specify which value refers to which variable. Otherwise, there will be confusion. Since you declare the parameter as value, you need to put this keyword before the instance variable so that it will be distinguishable by the compiler.

   public void setValue(int value){

       this.value = value;

   }

   public int getValue(){

       return value;

   }

}

Explanation:

I fixed the errors. You may see them as comments in the code

7 0
3 years ago
Edward Steichen was very famous in the history of photography. Why was he famous
BaLLatris [955]

Answer:

He retired from fashion and commercial photography in 1937. ... Two years after he retired from the Navy, Edward Steichen became the director of the Photography Department at the Museum of Modern Art in New York. There he created what has become the most famous photographic exhibition of all time, The Family of Man.

pls mark me as brainliest

4 0
3 years ago
What is the full form of" MIPS"​
Zepler [3.9K]
Million instructions per second
4 0
3 years ago
Read 2 more answers
Other questions:
  • Race conditions are possible in many computer systems. Consider a banking system with two methods: deposit(amount) and withdraw(
    14·1 answer
  • When selecting current page from the print range, on the print dialong box it will print
    5·1 answer
  • Why does Zoologist have no work experience in a related occupation?
    5·1 answer
  • What property of semi-metals is useful in the computer industry?
    7·1 answer
  • Software that translates the sound of human voice into text is called:________.
    14·1 answer
  • Tomahawk Industries develops weapons control systems for the military. The company designed a system that requires two different
    13·1 answer
  • Which types of computers are used by large businesses
    10·1 answer
  • er reports that he is having problems with his monitor. He explains that his laptop's liquid crystal display (LCD) is no longer
    13·1 answer
  • With a(n) ______, a search engine will show ads that have the keyword typed exactly as the searcher used, but may also have othe
    6·1 answer
  • What is the basic body structure of html.
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!