c++ - vector does not name a type -


i have error in title: here class declaration of variables , prototypes of function

#ifndef rozkladliczby_h #define rozkladliczby_h   class rozkladliczby{ public:     rozkladliczby(int);                  //konstruktor     vector<int> czynnikipierwsze(int); //metoda     ~rozkladliczby(); };     #endif 

and class body:

#include "rozkladliczby.h" using namespace std; #include <iostream> #include <vector>     rozkladliczby::~rozkladliczby()         //destruktor {}  rozkladliczby::rozkladliczby(int n){ int* tab = new int[n+1]; int i,j;  for( i=0;i<=n;i++)     tab[i]=0;                  //zerujemy tablice  for( i=2;i<=n;i+=2)     tab[i]=2;                  //zajmujemy sie liczbami parzystymi  for(i=3; i<=n;i+=2)     for(j=i;j<=n;j+=i)         //sito erastotesa         if(tab[j]==0)             tab[j]=i;  }     vector<int> rozkladliczby::czynnikipierwsze(int m){ vector<int> tablica; while(m!=1){         tablica.push_back(tab[m]);         m=m/tab[m]; }  return tablica;  } 

whats wrong prototype of function in first block? why vector told not type? grateful if u me find out this.

change header file to:

#ifndef rozkladliczby_h #define rozkladliczby_h #include <vector>  class rozkladliczby{ public:     rozkladliczby(int);                  //konstruktor     std::vector<int> czynnikipierwsze(int); //metoda     ~rozkladliczby(); private:     int* tab; };     #endif 

Comments

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -