[ create a new paste ] login | about

Link: http://codepad.org/6iH27Jff    [ raw code | output | fork ]

C, pasted on Apr 18:
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <string>
#include <math.h>
#include <stdlib.h>
#include <cctype>
#include <stack>
#include <queue>
#include <map>
#include <vector>
#include <sstream>
#include <utility>
#include <time.h>

using namespace std;

vector<string> str_index ;
map<string , int> str_counter ;

int main()
{
    long int i,j,k,t_case,len,len2,flag,count ;
    string str,tmp ;
    getline(cin , str) ;
    stringstream ss(str) ;
    while(ss >> tmp)
    {
        str_index.push_back(tmp) ;
    }
    len = str_index.size() ;
    for(i = 0 ; i < len ; i++)
    {
        tmp = str_index[i] ;
        str_counter[tmp]++ ;
    }
    for(i = 0 ; i < len ; i++)
    {
        tmp = str_index[i] ;
        if(str_counter[tmp] != 0)
        {
            cout << tmp << " " << str_counter[tmp] << endl ;
            str_counter[tmp] = 0 ;
        }
    }
    return 0 ;
}


Output:
Line 19: error: iostream: No such file or directory
Line 20: error: algorithm: No such file or directory
Line 17: error: string: No such file or directory
Line 17: error: cctype: No such file or directory
Line 16: error: stack: No such file or directory
Line 16: error: queue: No such file or directory
Line 14: error: map: No such file or directory
Line 17: error: vector: No such file or directory
Line 18: error: sstream: No such file or directory
Line 18: error: utility: No such file or directory
Line 17: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'namespace'
Line 19: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
Line 20: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
In function 'main':
Line 25: error: 'string' undeclared (first use in this function)
Line 25: error: (Each undeclared identifier is reported only once
Line 25: error: for each function it appears in.)
Line 25: error: expected ';' before 'str'
Line 26: error: 'cin' undeclared (first use in this function)
Line 26: error: 'str' undeclared (first use in this function)
Line 27: error: 'stringstream' undeclared (first use in this function)
Line 27: error: expected ';' before 'ss'
Line 28: error: 'ss' undeclared (first use in this function)
Line 28: error: 'tmp' undeclared (first use in this function)
Line 30: error: 'str_index' undeclared (first use in this function)
Line 36: error: 'str_counter' undeclared (first use in this function)
Line 43: error: 'cout' undeclared (first use in this function)
Line 43: error: 'endl' undeclared (first use in this function)


Create a new paste based on this one


Comments: