|
Determines the number of elements in the hash table for the map. // msdn: GetHashTableSize();
Retrieves the number of elements in the map. //msdn: GetCount()
And I read some articles, they say Hashmap is equivalent to Hashtable.
So, what is the difference between GetCount() and GetHashSize() confused me
|
|
|
|
|
econy wrote: So, what is the difference between GetCount() and GetHashSize()
GetCount returns the number of elements in the Map, e.g. 1000. GetHashSize gives the size of the Hash table that is used to manage the Map; in most cases this information is not useful to you.
|
|
|
|
|
Hi everyone, I am taking my first programming class and am at a loss on this program. Any tips for making this wrk? Thanks!
#include<stdio.h>
int main()
{
int month,day,opselect;
printf("\nEnter a month between 1 and 12: \n ");
scanf("%d",&month);
while (month < 1 || month > 12)
{
printf("Error the month entered is not valid.\n");
printf("\nEnter a month between between 1 and 12: ");
scanf("%d",&month);
}
printf("The month accepted is %d\n",month);
printf("\nEnter a day between 1 and 31: \n ");
scanf("%d",&day);
scanf("%d",opselect);
switch (opselect)
if (month=2)
(day < 1 || day > 28);
{
printf("Error the day entered is not valid.\n");
printf("\nEnter a day between 1 and 28\n");
scanf("%d,&day");
}
else (month=4,6,9,11)
(day < 1 || day > 30);
{
printf("Error the day entered is not valid.\n");
printf("\nEnter a day between 1 and 30\n");
scanf("%d,&day");
}
return 0;
}
errors are "else w/o a previous if"
and "expression can not be used as a function"
|
|
|
|
|
You code contains many errors:
The scanf() call for opselect misses the ampersand & .
There is an empty switch statement.
C/C++ comparisons use two equal signs.
This is a complete if sequence:
if (month=2)
(day < 1 || day > 28);
Because there is other code following before the else , the compiler can not found any corresponding if and generates an error. The code following the if statement is an expression (day < 1 || day > 28). But the compiler expects a statement or a function call and generates another error.
As already noted, comparisons use two equal signs. Your code assings the value 2 to month and the if condition is always true.
I guess you want something like this:
if (month == 2 && (day < 1 || day > 28))
{
}
else if ((month == 4 || month == 6 || month == 9 || month == 11) && (day < 1 || day > 30))
{
}
|
|
|
|
|
Thanks, I am trying to implement your suggestions here is what I currently have..
#include <stdio.h>
#define MAXCOUNT 10
int main ()
{
int opselect;
int day, month;
printf("Enter a month between 1-12 :");
scanf("%d", &month);
printf("Enter a number for the day of the month");
scanf("%d", &day);
scanf("%d", &opselect);
switch (opselect) {
case 1:
if (month==2 && (day < 1 || > 28))
{printf("\nEnter a day between 1 and 28: \n ");
scanf("%d",&day);
}
case 2:
else if (month==4 || month==6 || month==9 || month==11)&&(day < 1 || day > 30))
{printf("\nEnter a day between 1 and 30: \n ");
scanf("%d",&day);
}
case 3:
else if (month==3 || month==5 || month==7 || month==10 || month==12)&&(day < 1 || day > 31))
{printf("\nEnter a day between 1 and 31: \n ");
scanf("%d",&day);
}
printf("The day accepted is %d\n",day);
return 0;
}
I am getting a ton of errors here, expected primary-expression before else, expected; before else.
What I am trying to do is based on the month input prompt for a the proper number of days in the month(2=28, 1=31 etc)and get in error message if you enter the wrong days(29 in Feb for example)
|
|
|
|
|
You are mixing a switch statement with if - else statements. That is not allowed. What is the opselect for? It seems unnecessary.
A more sophisticated solution would use an own function that checks if a day/month combination is valid:
if (!CheckDate(month, day))
{
printf("\nInvalid day/month combination. Please enter a valid day:\n");
scanf("%d",&day);
}
|
|
|
|
|
This assignment calls for a switch statement, I thought you needed opselect when using a switch? I tired using case:1, case 2 etc..., but I couldn't make it work. How do I do the switch w/o the if statements? Thank you so much for your help.
|
|
|
|
|
Thank you!!! Removed opselect and it works!
|
|
|
|
|
I donot know your C program.
Please talk me you realize the function.
I come from China.My English is not good.I hope you can understand my replay.
|
|
|
|
|
Dear all:
I get touch data by used HID.dll, it is raw data.
I wanna process the raw data, before send it to OS.
How can I send touch to OS, using postmessage or sendmessage?
if so, How can I use it?
Thank for your help, Victor.
|
|
|
|
|
Hello All, Could you help me speed up a program? It's designed to find the square root of a number.
<pre lang="c++">
#include<iostream>
using namespace std;
int main()
{
float a;
float c;
cout << "Square root calculator!" << endl;
cout << "Enter the number you want to square root" << endl;
cin >> a;
cout << "Enter an educated guess" << endl;
cin >> c;
cout << "The squareroot of " << a << " is: " << endl;
do
c = (c + (a/c))/2;
while ( c != a/c );
{ cout << c << endl;
}
return 0;
}
</pre>
My problem is that it get remarkably slow around 55ish. Any advice it appreciated
|
|
|
|
|
|
I'm guessing your issue is the while(). Comparing two floats can be tricky.
while ( c != a/c );
this[^] link may help.
|
|
|
|
|
That is the problem with the Babylonian method you have used.
Paul Hsieh has a very good webpage on everything about square roots but were afraid to ask.
http://www.azillionmonkeys.com/qed/sqroot.html[^]
It includes details most of the techniques from the standard C library, to the faster integers version that NVidia and Quake use.
|
|
|
|
|
hi..i have a requirement to write C/c++ application that converts Microsoft Word
(.doc) Documents into XML format. The application should be able to receive/open a Word document and save a XMl file with the same
name, but with the extension .xml..ur valuable suggestions will help me n will be appreciated..thanks
|
|
|
|
|
|
is there any library file to include in the code?..how to convert the entire docx formate?
|
|
|
|
|
You need to follow some of those links and do some research. As I said, reading Word documents in C/C++ is not particularly easy, unless you are familiar with C++/CLI, in which case you can use the Microsoft.Office.Interop.Word Namespace[^]
|
|
|
|
|
yes i have good experience in c++ but i have not worked on this requirements..if so i can read the data but question is how to store tht in xml format...suggestions will be greatly appreciated
|
|
|
|
|
krishnaprasad t wrote: how to store tht in xml format Store what? A word document is just like a book, lots of words separated by punctuation characters. In order to store that as XML you will need to design a set of rules and tags to split the data into logical sets. Each set would probably need some attrinutes, such as font (character set, height, fixed or true-type, bold, italic etc.). Writing the final XML is just a question of using one of the XML libraries available, either Microsoft or third-party.
|
|
|
|
|
thank u for ur reply..can u pls provide me links it would great help
|
|
|
|
|
I already gave you a link to the Word Interop. You should be able to search MSDN for yourself to find other pages of interest.
|
|
|
|
|
I'm thinking the easiest way would be to use Office Automation.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
why do we use %u while outputting addresses????
|
|
|
|
|
I would say that %p is preferred. Maybe this[^] link will help.
|
|
|
|