473,396 Members | 2,017 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Main function error

Sorry for bothering :( but another error happened when I tried to write the main function.
It says : error C2228: left of '.getLoadFactor' must have class/struct/union type

Not calling loadfactor is the only problem but when I try to call any one of them (insert,remove...)
Anyone know what this mean? And especially HOW to fix it??

Greetz
Dec 18 '11 #1
4 1760
weaknessforcats
9,208 Expert Mod 8TB
The error is here:

Expand|Select|Wrap|Line Numbers
  1. HASH STUDENT();
This is a call to the HASH default constructor. The compiler creates a temporary HASH object for this statement, calls the HASH constructor, and then deletes the temporary object at the end of the statement.

Just do this:

Expand|Select|Wrap|Line Numbers
  1. HASH STUDENT;
This tells the compiler to create a local variable of type HASH named STUDENT and then to call the default HASH constructor to initialize the variable.
Dec 18 '11 #2
Ok I did what u said the error has gone but a run time error has happened why???? is there anything wrong with my array??? what should I do??

Can u show how to write a good main function to test this implementation??
Dec 18 '11 #3
weaknessforcats
9,208 Expert Mod 8TB
Probably you are going outside the array bounds.

There are no checks in your code to make sure you are inside your array.

My first suggestion is to use std::string instead of arrays. std::string has all the protective code needed to stay inside the array used by std::string.

Otherwise, you step through the code using your debugger to see where the crash occurs.

As to testing, that's a big subject. I would suggest that you test using data that you know is smaller than your arrays. When you get it working this way, then you can provide data designed too provoke a crash.
Dec 18 '11 #4
I think I understand I will try what u said thank u very much for helping me
u were very helpful :)
thanks again
Dec 18 '11 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: wongjoekmeu | last post by:
Hello All, >From a book where I have learned C++ it says that each application must have at least one function which is the main() function. Now I have the source code of a C++ program from...
6
by: davinci | last post by:
I had study it for a long time .but I didn't solve it .Ihad read <<Debuging with GDB>> But I didn't get something useful. include<iostream> #include<cstdlib> using std::isdigit; int main() { ...
6
by: Puzzled | last post by:
This is a weird problem, but perhaps someone else has seen it before (I hope!) If I use a fully qualified include call include ( 'http://localhost/subtree/filename.php') I get an 'undefined...
1
by: wayne.denier | last post by:
Ran across this well documented, nice looking library for C++ gaming called Amaltheia ( http://home.gna.org/amaltheia/ ), but they don't have a community :P. I'm not sure if anybody has used it...
1
by: joe10001 | last post by:
Hi all, I just installed CRELoaded (oscommerce fork) on my server and all work fine except that I have a little message at the bottom of the main page : Fatal error: main() : Security alert:...
19
by: beliavsky | last post by:
I think I read a suggestion somewhere to wrap the code where a Python script starts in a main() function, so one has def main(): print "hi" main() instead of
1
by: shiniskumar | last post by:
i go tto perform some validation while ck=liking a button without refreshing the value.. i used ajax.My code is as follows...on button click i call the function validateGridAdd(); Inside tat...
28
by: ravi | last post by:
Hello everybody, I am writing a small application which does some work before the user main function starts execution. I am trying to #define the main function. But the problem is that,
11
by: aarklon | last post by:
Hi all, I have heard many discussions among my colleagues that main is a user defined function or not. arguments in favour:- 1) if it is built in function it must be defined in some header...
6
by: Soorali | last post by:
Hi I am a newbie to VC++ and this is my first independent project so please pardon my ignorance!! My project compiles and runs perfectly fine in Debug mode. However, when I try to compile it...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.