Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

qsort. See the example in that post.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

There is a free one at www.DataReel.com, has been ported to both *nix and MS-Windows, and has scripts to compile with most popular compilers under both operating systems. Also contains a lot of examples.

There are probably a lot of other free libraries too but that is the only one I've actually used (and no, I didn't write it).

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

In that last loop you have to just count the number of items that are zero. Then after the end of the loop if the counter is still zero you can display the "no Inventory" message.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>But the exe your file and exe of author file is very different.

I don't know what the difference is. I just used the code you posted earlier, nothing more and nothing less. If it isn't the same as in the tutorial its up to you to determine the difference.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>COULD Ne1 help m eout
Huh??? is that Chinese or Japanese you are writing. Please write English.

>>converting it to binary
converting what to binary? Your program? All you have to do is use a compiler and compile it. The compiler will create the *.exe file (well, technically its the linker that does that.).

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

you don't have to do line 16 and 17. GetConsoleWindow() will return the HWND handle of the console program.

line 20: getch is not such a good idea in this program because there is no way for the program to terminate unless the user KNOWS that it is looking for keyboard input.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>I've missed my classes and tried to read some tutorials but it's too damn confusing
Well, how about reading your textbook for the class you are taking ?

>>but it's too damn confusing
Yes I agree it is confusing at start. I felt that way too when I first started. Hang in there and keep reading because it will come to you eventually.


Here is the beginning

#include <iostream>
using namespace std;

int main()
{
   // your code goes here
   return 0;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

methods of a class are never ever on the stack -- only data objects go there.

int main()
{
    Foo f; // object f goes on the stack, but not the methods of that object.
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>void main()
Not valid code. use int main() instead.

all you have to do is write two functions. Please show us the code YOU have written to complete that assignment. We will NOT do your homework for you, but will gladly help you write it yourself.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>If some one can do this please post the code, I'd be trully grateful.
I'm sure you would be grateful, but doing yourself disservice by not doing it yourself. We will NOT do your homework for you. Post the code that you can do and ask questions about what you can not do.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>Your Project1.dev does't include files like ( c , rc , h).
Yes it does -- but it contains main.cpp not main.c. So I just no renamed it to main.c and recompiled. No problems with that either.

>>when i go to the project option->Files->and click on the ( rc ) file the the Dev-C++ included linking.
Mine was clicked by default and greyed out so that I can't change it. See attached bitmap

>>So ,Ancient Dragon does it mind anything to you?
If you mean do I get any errors -- No I don't.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>and i cammot figure out why.
Because you told it to print it on line 82. Delete that line and it will be ok.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>i'm around for more clarificaions
Ok, then lets see the code YOU have written.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

C and C++ languages really don't have a character data type -- char is readlly just a one-byte integer. Characters such as 'a', 'b', etc can be represented in char, int, or long because internally they are just integers and have an integer value. What you see as on the screen or on paper is just the representation of the letter and depends on the font that is used to print it.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

and don't be afraid to make liberal use of { and } in the loops so that you can add additional lines with the loops. Even though not required with one-line statements they braces are good to use so that you can easily change the code.

for(int i=0; i<10; i++)
{
    for(int ii=0; ii<10; ii++)
    {
         if (nums[ii] > nums[ii + 1])
         {
            Swap = nums[ii];
            nums[ii] = nums[ii + 1];
            nums[ii + 1] = Swap;
         }
    }
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

ballets should have the option "None of the above". And if that gets the majority of votes then a new election must be called within a year and all candidates on the previous ballet are ineligible for the new election.

Salem commented: I like the "ineligible" part :) +12
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

With 28 posts you should know by now that you have to post code if you expect anyone to be able to answer your question.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I would probably put that prompt between lines 41 and 42.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

First you need to initialize the array to some known value -- normally 0 -- to prevent it containing random values. Here is the easiest and most common way to do that char key[25] = {0}; Is your program going to be case-insensitive? That is, 'A' is treated the same as 'a'? If so then you will want to convert whatever you type to either upper or lower case letters before inserting the letter into the array and before attempting to search the array for the letter.

You do not want to add the key into the array right away -- use a different variable for the data entry. Then search the array for that value, if not found then insert it at the next available slot then increment that counter. If found then you can display the error message. The loop you have coded will fail when it comes across the kth element.

There are other ways to search for the letter -- strrchr() will return the index value if the letter is found. Example: assume index is an integer that counts the number of letters inserted into the array.

if( strchr(keys,'a') )
{
   // letter 'a' is already in the array
}
else
{
   keys[index++] = 'a';
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I am running Vista Home Premium with default installation and all Microsoft updates. I just now created a new project and added the files you posted. Dev-C++ compiled them without warnings or errors, and ran ok too. Attached are my project files. After unziping it into the directory of your choice use Dev-C++ to open the file Project1.dev

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Nothing -- it is blank. I use the default settings when the compiler is installed.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Ok, so you want to add that feature. What is your question ?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

list of of the executables in c:\windows directory, all of its sub directories and everywhere else on your computer's hard drive. That's how many things can be run with the system function. There are litterally thousands of them, so attempting to post them here is pointless.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Which part of that assignment do you need help on? What don't you understand ? Have you even tried yet ?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I have not seen any problems using VC++ 2005 Express or VC++ 6.0 in Vista Home. They produce a few warning messages when started but ignoring them does not seem to do any harm. Could be because I don't write programs that take advantage of any new Vista features. I have not tried it yet but I would imagine the compatibility problems are resulved with VC++ 2008

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

simple: contains time functions.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Ancient, is it possible you caught the very tail end of it?

Possible, but I don't think so. Seems like it was only for a few minutes.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

From a long time spending.

And why the project have a several mistakes when i put the files ( rc , c, h) into project?

What are the errors? Post a few of them.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>'bool Point::includes(const Point &) const' : overloaded member function not found in 'Point'
Check spelling -- should be PointCollection::includes. Others probably have a similar error

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>What is the mutable keyword?
never heard of it.

>>what are the differences between a pointer and reference
Read your textbook or other threads

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

try reading your textbook to get the answers.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>What happens if a pointer is deleted twice
Depends. If you set the value of the pointer to 0 after the first delete then nothing will happen. But if you don't then the program will probably crash.

>>value or pass by reference
Nothing -- almost. They both have the same idental affect on the original variable

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Use system('mkdir');

No need for the system call -- just call mkdir function.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

what is Dosing ?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>How do i compare the strings to check if any words are the same?
strcmp()

>>also how should put the tokenized string into a array, a loop?

char *array[255] = {0}; // room for 255 strings
int i = 0;
...
array[i] = tokenPtr;
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>romNum[ strlen( romNum ) ] = '\0';
That line is not necessary when using fscanf(). Only need it with fgets(). If you use it with fscanf() you will chop off the right-most letter in the roman numerial

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

It is a lot easier to sort the data if you should create a structure to hold the information for one city then create an array of those structures.

>>strcmp not liking the strings.
Yes, strcmp() wants char*, not strings. If you using string objects then you can pass method c_str() to strcmp().

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>your code did the job, it was something to do with the file itself it was trying to read.
It had nothing at all to do with the file -- the problem was your code was wrong.

>> the file i'm reading from has more than one line of roman numerals in it, but only the last line is displayed by the printf;
Yes I saw that too. If you want to display all of them then put the print statement inside the loop.

>>how can i get those characters that have just been read in the file, and convert them the same way as is done in the "instant conversion" part of my program
It should be obvious -- do it the same way that you did before by calling that function inside the loop.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>while (!feof(file_numerals));

That is an infinite loop! code it like I posted previously or remove the semicolon at the end of that line.

you also need to add a check that the file was opened ok.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Post the whole program so that I can take a look at it.

>> rewind (file_numerals);
That isn't necessary after the open statement because the file pointer is set to the beginning of the file when it is opened (this behavior can be changed depending on some of the other open flags)

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>But it is made up of many countries
There is nothing in the explaination I read that said an island has to be made up of just one country (or nation).

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>file_numerals = fopen (("%s", fileName),"r");
The first parameter to fopen is NOT a format string like printf() but the filename. How did you even get this program to compile without any errors anyway????? Here is how it should be: file_numerials = fopen(filename, "r");

while (!feof(file_numerals));
{
fscanf (file_numerals, "%s", &romNum);
}

That's the wrong loop and won't work the way you think it will. I assume you want to read the file one word at a time instead of a whole line at a time. And you do NOT use the '&' symbol in front of the variable name because romNum is passed by reference (or pointer) by default.

while( fscanf (file_numerals, "%s", romNum) > 0)
{
    // do something
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Here is the standard way to convert a string to upper case

while (*c)
    {
       *c = toppper(*c);
        ++c;
    }

After tokenizing the string you need to put them in an array so that you can search the array for a string.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

That would be a tough problem to find because there is no consistency. It happened to me for about 5 minutes or so this morning and has not happened since then.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>I hope you'll see this information helpful...
Oh God how much more could you be wrong! To OP: forget the crap that he just posted, its nonsense.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

This is what I got for awhile this morning.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>The program is not same as Writer wrote
Your link doesn't work. I can't help you if you don't post the code you wrote.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You don't add the icon files either because the *.rc file will include them.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

First, create a new project File --> New --> Project
After that, copy the files from the project you posted into the Dev-C++ project you just created then add those files to the project. In the Project tab on the left side of the screen expand the Project1 folder (assuming you named the new project the default name). Right click on that folder name and select Add To Project menu item.

You do not need the makefile that's in the link. So do not attempt to add it to your project.

The second link you posted doesn't work.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You need a smarter compiler. Here's the warning I get with VC++ 2005 Express

\dvlp\test12\test12\test12.cpp(89) : warning C4717: 'rad' : recursive on all control paths, function will cause runtime stack overflow

The reason is that the last line of the rad() function make a recursive call without bounds. That is, there is nothing to stop the recursion. And every recursive call gobbles up (110 * sizeof(int)) +8 (more or less) number of bytes on the stack, so eventually that will consume all the stack space.