I am kind of new to C++ so I wanted help writing a program where the user enters the text and the program cout word and its number of repeated times.
Example:
Hello this is a test 1.
Hello this is a test 2.
I mean I get to do a program that counts how many times the word is repeated in a text that is entered by a user. Like in the above example I want to output the word hello and beside it how many times it is repeated. The text I obtain is when the user cin>> it !!
get me now??
Actually, you can accomplish this with vectors Mennah. I don't want to provide the code for you to do it, however I suggest you research C++ vectors. I'll just give you an idea of how to get started:
Ex.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
#include<iostream>
#include<vector>
int main()
{
vector<string> test //container holding the word being pushed back
string hold; //word you wish to have pushed back
while(cin>>hold){
test.push_back(hold) //pushes back what the user enters
}