Click here to Skip to main content
15,887,272 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionProgramming with multiple entry points Pin
Dan Senior7-Jan-10 21:40
Dan Senior7-Jan-10 21:40 
AnswerRe: Programming with multiple entry points - updated Pin
Garth J Lancaster7-Jan-10 21:50
professionalGarth J Lancaster7-Jan-10 21:50 
AnswerRe: Programming with multiple entry points Pin
Naveen7-Jan-10 22:07
Naveen7-Jan-10 22:07 
AnswerRe: Programming with multiple entry points Pin
Rajesh R Subramanian8-Jan-10 4:55
professionalRajesh R Subramanian8-Jan-10 4:55 
AnswerRe: Programming with multiple entry points Pin
Dan Senior8-Jan-10 11:00
Dan Senior8-Jan-10 11:00 
AnswerRe: Programming with multiple entry points Pin
Rozis8-Jan-10 11:52
Rozis8-Jan-10 11:52 
GeneralRe: Programming with multiple entry points Pin
Dan Senior8-Jan-10 14:04
Dan Senior8-Jan-10 14:04 
Questionlinking two file in gcc Pin
khomeyni7-Jan-10 21:10
khomeyni7-Jan-10 21:10 
hello i tried to link this two file:


#include<list.h>
template <class T>class hash{
public:
list<int> *l;
int m,n;//k is the entry and m is number of slots and n is the size of our array
hash(){
l=new list<T>[n];
n=m=0;
}
hash(int n1,int m1){
n=n1;
m=m1;
l=new list<T>[n];
}
int hashfunct(T k){
return k % m;
}
void print_hash (){
for(int i=0;i<n;i++)
while(!l[i].empty()){
cout<<"l["<<i<<"]="<<l[i].front()<<" ";
l[i].pop_front();
cout<<endl;
}
}
list<T>* add_to_hash(T k){
int key=h.hashfunct(k);
l[key].push_front(k);
return l;
}
};




and the main program:


#include<iostream>
#include<stdlib.h>
#include "/home/sajad/src/ds/test/hashfunctions/hash.h "
using namespace std;
int main(){
int n;
int m;
cout<<"please enter n(number of entries):"<<endl;
cin>>n;
cout<<"please enter m(the dividisor number,must be near n):"<<endl;
cin>>m;
int a[n];
for(int i=0;i<n;i++)
a[i]=0;
hash<int>h(n,m);
cout<<"please enter n numbers:"<<endl;
for(int i=0;i<n;i++){
cin>>a[i];
h.add_to_hash(a[i]);
}
cout<<"after hashing:"<<endl;
h.print_hash();
return 0;
}


the address of hash.h is completely true but i face this error:

[sajad@sajad hashfunctions]$ g++ my\ hashing.cpp
my hashing.cpp:4:57: error: /home/sajad/src/ds/test/hashfunctions/hash.h : No such file or directory
my hashing.cpp: In function ‘int main()’:
my hashing.cpp:16: error: ‘hash’ was not declared in this scope
my hashing.cpp:16: error: expected primary-expression before ‘int’
my hashing.cpp:16: error: expected ‘;’ before ‘int’
my hashing.cpp:20: error: ‘h’ was not declared in this scope
my hashing.cpp:23: error: ‘h’ was not declared in this scope
[sajad@sajad hashfunctions]$



can anyine help me?
thnx.
QuestionRe: linking two file in gcc Pin
CPallini7-Jan-10 21:25
mveCPallini7-Jan-10 21:25 
AnswerRe: linking two file in gcc [modified] Pin
khomeyni7-Jan-10 21:52
khomeyni7-Jan-10 21:52 
GeneralRe: linking two file in gcc Pin
CPallini7-Jan-10 22:09
mveCPallini7-Jan-10 22:09 
GeneralRe: linking two file in gcc Pin
khomeyni8-Jan-10 2:48
khomeyni8-Jan-10 2:48 
GeneralRe: linking two file in gcc Pin
CPallini8-Jan-10 5:00
mveCPallini8-Jan-10 5:00 
GeneralRe: linking two file in gcc Pin
khomeyni8-Jan-10 5:39
khomeyni8-Jan-10 5:39 
Questionpolygon made by intersection of two polygon ??? Pin
a04.lqd7-Jan-10 20:49
a04.lqd7-Jan-10 20:49 
AnswerRe: polygon made by intersection of two polygon ??? Pin
Cedric Moonen7-Jan-10 20:56
Cedric Moonen7-Jan-10 20:56 
AnswerRe: polygon made by intersection of two polygon ??? Pin
Hamid_RT7-Jan-10 20:57
Hamid_RT7-Jan-10 20:57 
AnswerRe: polygon made by intersection of two polygon ??? Pin
Nelek7-Jan-10 21:09
protectorNelek7-Jan-10 21:09 
AnswerRe: polygon made by intersection of two polygon ??? Pin
CPallini7-Jan-10 21:13
mveCPallini7-Jan-10 21:13 
GeneralRe: polygon made by intersection of two polygon ??? Pin
Cedric Moonen7-Jan-10 21:15
Cedric Moonen7-Jan-10 21:15 
GeneralRe: polygon made by intersection of two polygon ??? Pin
Nelek7-Jan-10 21:19
protectorNelek7-Jan-10 21:19 
AnswerRe: polygon made by intersection of two polygon ??? Pin
Saurabh.Garg9-Jan-10 14:39
Saurabh.Garg9-Jan-10 14:39 
GeneralRe: polygon made by intersection of two polygon ??? Pin
a04.lqd9-Jan-10 14:51
a04.lqd9-Jan-10 14:51 
Questionstrcmp for NULL character Pin
Anu_Bala7-Jan-10 18:50
Anu_Bala7-Jan-10 18:50 
AnswerRe: strcmp for NULL character Pin
Naveen7-Jan-10 19:16
Naveen7-Jan-10 19:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.