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

You need to design some system to count the number of times each value appears in the array. If you do this with pencil & paper it will become clear how to do it. First start out with a clean sheet of paper, nothing on it. Now write column headings, one called Value and a little but to the right of that name it Count.

Now look at the first number in the array. Its a 1. Is there a 1 on that piece of paper? No because this is the first number, to under the Value column write a 1 and under the Count column write a 1 (first count).

Look at the second number. Its a 2, so is there a 2 under the Value column on the paper? No, so under the Value colum add another line with the Value of 2 and 1 in the Count colunm.

Look at the third number. Its another 2. There is alread a 2 under the Value column so increment is count from 1 to 2.

Do that for each of the other values in the array. After you are done you can easily see which Value has the greatest Count.

The above is the same concept you will use in your program. You could use two arrays of integers or one array of structures, whichever is easiest for you.

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

What compiler are you using ? The program is probably indexing beyond the bounds of arrays, or the index values are crap. Can't really help much without the whole program.

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

Anyone know what the name is for the church Obama proclaim his membership in? I've heard some stuff about that from others, and it'd be nice to be able to confirm/refute what I've heard.

He is a member of this church

As for Fred Thompson -- he's too nice. This is no such thing as a nice politician. I don't think he had his heart onto this campaign anyway. He appeared to me as if he didn't really want to do that.

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

I would not equate the freedom to polute with puffing your smoke into somebody's face in public. !

But it is the same thing. A car or truck in front of me with smoke billoing out the tailpipe is just as offensive as tobacco smoke. Or how about the huge amount of smoke and other nasty stuff that comes out of smokestakes as many manufacturering plants. If that doesn't convince you then fly into LA on a nasty day when the smog is so think you can't see the ground.

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

can anyone help me that isnt a ****

Oh?? what you really mean is "will someone write this because I'm too lazy or dumb to do it myself".

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

I would create a structure that contains a value and the count for that value

struct data
{
    int value;
    int frequency;
};

Now make an array of those structures and initialize everythig to 0. Then begin the loop you wrote on line 11. For each value in the array list search the array of structures for the value. If there isn't one in the structure array add one. If there is an element in the structure array for the value in the aray array then just increment the frequency counter. When the loop finishes you have the information you need.

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

ah i know and what is the best of the two the software developer or web developer. (opinion only)

There is no best because they are both needed so if you are in school you should learn both.

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

Ah, I understand what happened.

Sorry RossSCann, I thought you had done the edit. (And I had flagged the post as "bad".)

I took care of that too. :)

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

Those links don't work for you?

Don't you dare put words in my mouth. If you want to edit your own posts again have fun.

I agree completely and apologize for that error. I meant to quote your post, not edit it. I removed my post and put it below.

MSDN is FREE for god's sake. www.microsoft.com But I suspect you are talking about the subscriptions which have huge annual fees.

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

Children are required to be in school ... ?
Sorry, that does not imply an education! Lots of kids graduate that can barely write their name.

You are right about that, unfortunately. And schools should loose their accredication for allowing that to happen.

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

America is about freedom, the freedom to be uneducated, the freedom to arm themselves, the freedom to belong to a church group, the freedom to work or not to work, the freedom to guzzle gas and polute the air, all is included in the word. Any politician doubting these sacred principles is on the losing end, as far as the average voters are concerned.

Only to the point where your freedoms do not conflict with my freedoms. You have the freedom to rob my house but I have the freedom to shoot you dead while doing that. If you choose not to work and you are otherwise perfectly capable of working then I have the freedom of not paying for your food, clothing, housing etc; as far as I'm concerned you can just live out in the cold and starve to death.

>>the freedom to be uneducated
No you don't. Children are required to be in school (or be home schooled) until they reach a certain age or graduate. You don't have the option of not doing that.

>> and polute the air
Don't have that freedom either. You don't have the freedom to smoke in public places here in Illinois anymore either.

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

>>please help me in developing editor same as C++
c++ is not an editor, its a computer programming language.

Are you talking about the IDE of a c++ compiler such as VC++ 2008 Express ? That would be very ambitious project and if you have to ask how to do it then you aren't ready to do it yet. That is a program that probably took several manyears to design, code and test.

Salem commented: I would have thought hundreds of years. +15
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You need to use your compiler's debugger to step through that code and find out what is causing the problem because it isn't apparent from what you posted.

I can tell you that lines 6 and 7 will produce very very small numbers. The purpose of dividing the return value of rand() by RAND_MAX (which is a huge number) isn't apparent.

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

Its times like that when I truely believe in the theory of survival of the fittest.

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

Start at the top and to the assignment one requirement at a time. For instance, you need to define constants the the prices of all those tickets.

Next you need to add the required comments. The code you posted failed to do that correctly.

You will probably have to declare int variables for the number of each kind of tickets and whether they are adult of childrens tickets.

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

there is no opposite of '\n'; If you want to move the cursor to another line you have to use some operating-specific cursor moving function. For MS-Windows console that means using some of the win32 api console functions (google for them). Or use a 3d party library such as the ncurses library which is a port from *nix curses. In any event there is no simple solution for that problem.

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

>>All i know is need to use constants.
You have failed to tell us what the program is supposed to do so how can we help you ?

>>Also under the type of ticket such as orchestra, etc how do I move the three options into more of a tab
That does that mean? Looks like the code you posted should be ok.

>>finally I need to know how to compute all this in
Again, we are not mind readers and have no idea what you are talking about.

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

>>while (stream1 >> aStudent.studentid)
when I compiled your code VC++ 2008 Express said aStudent is undefined.

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

Probably the most famous of all time -- "Frankly, my dear, I don't give a damn!" (Gone With The Wind)

See others here

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

>>Is there a fix?
Yes -- don't install that on Vista. Most old compilers don't work very well, if at all, on Vista. The good news is that you can download the newest version VB 2008 Express free from here.

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

Here are some example console programs. I have not used to code for a few years, but since its win32 api functions I suppose the programs will work with modern compilers.

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

seems to be ok now. don't know why.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
class X{
public:
    X() {m1 = 0;}
    static DWORD WINAPI mythread(LPVOID lparam);
protected:
int method m1;
};

Since mythread() is a static member of that class you can pass it to CreateThread as the thread function.

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

[EDIT] Alas, AD, the cursor info is for the little blinking square or underline in the output console display.

Ah yes -- that only sets the size of that blinking cursor. Need to call ReadConsoleInput() to retrieve the mouse events.

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

if you declare the pointer in main() then just pass it by reference to the other functions that need it, just as you would any other parameter.

There are two ways you can do this: pass a pointer to the array -- see the tripple stars in the declaraction. That means its a pointer to a 2d array.

char **foo( char*** array, size_t size)
{
    *array = new char*[size];
}

int main()
{
    char **array = 0;
    foo( &array, 10 );
}

Or use the c++ reference operator &, which simplifies all those asterisks

char **foo( char**& array, size_t size)
{
    array = new char*[size];
}

int main()
{
    char **array = 0;
    foo( array,10 );
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Ma, I'm gona rip off your head and shit down your throat in the movie Dr Detroit when he is threating the town female mob boss.

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

What do you meen "my own realloc"

c++ does not have the equivalent of the realloc() function, which allocates a new pointer, copies the data from the old pointer to the new pointer, then deletes the old pointer. And you can't use realloc() if you used new. So you would have to write your own function that does the same thing as realloc() but uses the new and delete operators.

And please how do you declare and define the pointer.

I already showed you that in my previous post. char **array declares an array of pointers to strings, which is the purpose of the two asterisks.

The program needs to have a main and functions

Yes, all (or most) c++ programs must have a main function.

Now, start writing your program and posting code if you need more help.

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

Just use a vector of strings.

I would normally agree but I don't think the OP has that option. This may be an assignment that teaches pointers, not vectors.

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

you don't call ReadFile() to read the mapped file into memory. See the examples and explaination in this article. The whole purpose of memory mapped files is to share data between processes. When Process A writes to the share memory, such as using strcpy() function, Process B will be able to see it immediately as if it had done the strcpy() itself. You do not use file i/o to do this.

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

answer: ifstream in("filname.ipg",ios::binary);

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

In c++ you have the choice of using either new operator or malloc() function to allocate that memory. new is preferred in c++ but malloc() may be a better solution when you need to change the size of the array while the program is running.

An array of pointers to strings that can be resized at any time is declared like this: char **array. to allocate memory for 20 strings

char **array = (char **)malloc(20 * sizeof(char **));

now, if you want to expand it to 30 strings

array = (char **)realloc(array, 30 * sizeof(char **));

Similar thig can be done using new but you have to write your own realloc() function.

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

I'm a little confused about what you are asking. Are you saying your sort algorithm works ok with English words, but not with words that use alphabets from other languages ? If that is correct then I'm afraid I can't be much help. You might research the SetLocal() function, or some associated function(s)

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

variables a, b, c and d can not be input like that. Do it like this: cin >> a >> b; You can't type the division symbol, but only the two numbers

you don't need lines 10 and 11, so you might as well delete them because they are wrong anyway.


BTW: Don't manually add line numbers when you post code because it makes it difficult for other to copy/paste into their own compiler for testing. Use code tags, which will add line numbers like this [code=c++] // your code goes here

[/code]

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

That path contains spaces, so you can't use the >> operator. use getline() instead to get the full path including all spaces.

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

>>Would that do it?
That only tells the compiler where to find the libraries. It does not tell the compiler what libraries to use.

There are a couple ways to do it
1) add a #pragma comment(lib,"d3d9.lib") near the top of one of your *.cpp or *.c files. That forces the compiler to link with that library

2) Project --> Properties -->Configuration Properties --> Linker --> Input, then in the panel on the right add the library name in Additional Dependencies edit control.

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

how did you tell your compiler that it needs to link with d3d9.lib ? My guess is that you didn't.

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

post code. you probably need to pass the c_str() method from the std::string object, as I illustrated in my previous post.

CodeBoy101 commented: perfect! +1
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

what would the "\b" character do?

Apparently you have never seen this list

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

That's a big topic -- what do you want help doing?

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

Since we can't see your monitor you will need to post the exact command(s) that you use to compile. If you are running a makefile then post the containts of that makefile.

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

Have you compiled and tested any of the code you posted ? Before you go any further you need to actually test all that code to see if it works correctly. Compile without error != work correctly.

There seems to be a lot of logic errors in your code, for example line 125 of List.cpp while (curr!=NULL && curr->item < awine) That won't work. why? because curr->item is a pointer and awine is a reference to an object. Not the same things so I doubt that code will even compile.

You are just wasting your efforts by attempting to add more to that code when the code you have won't compile and has not been tested.

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

>>first !a is evaluated as the boolian result false, but then a boolian result can not be incremented.
Bingo!

>>(!a++) ie equel to (!(a++))
When in doubt, use parantheses for clarity.

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

>>i dont undestand how to do it

Ok, here's an example. Its not a complete program so you can't compile it as is.

string word;
ifstream in("infile.txt");
while( in >> word)
{
    if( word.length() == 3)
    {
           // this is a grade
    }
    else
    {
          // this is an ID
     }
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

see thumbnail.

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

1 001
002
003
2 005
009
004

If you look at the data you will see that the student id is just a single character, but grades are all 3 digits left-padded with 0s. So if you read the file in as words (strings) instead of integers you can easily test the string to see if the word is three characters then its a grade, otherwise its an ID.

read a word
is the length of the word 3 characters ?
yes, then we have a grade
no, we have a student id
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Sorry, rules are rules. No one here is going to write your program for you.

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

read it in very similar to the way you wrote it out

node *temp;
ifstream infile("page.txt");
temp  = new node;
while( infile >> temp->start) // read until end-of-file
{
    infile >> temp->name >> temp->area // etc. etc
    // add temp to the linked list.  You didn't post that part so I can't help you with that
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I can see why that doesn't compile -- I don't have a clue what its trying to do.

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

>> I also tried including the C:\Program Files\Microsoft DirectX SDK (August 2007)\Lib\x64 and x86 directories (where d3dx9.lib is located),

Where did you add those paths? They should be in the "Library Files" tab, as shown in this thumbnail