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

>>char combinearrays(const char *array1, const char *array2) {

The function needs to return a pointer to an array, not a single character.

>>return *text;
>>free (text);

line 45 -- free(text) -- is unreachable and will never get executed because of line 44.

line 44: should be return text; -- remove the star

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

>>i'm an intern

As an intern your prospects for getting full time work is retty slim because you don't even know how to read yet. Come back in about 10 years, after you have learned how to read and comprehend what you read.

Geek's Lounge is not the place for posting support questions.

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

Have you tried google? If not, then you should.

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

free vc++ 2007 Express (google and you will find the download link). But there are others, such as Code::Blocks, also free. Neither produce 64-bit pograms, but the 32-bit programs they produce run well on 64-bit Windows 7.

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

Move line30 up to line 29 so that it's within the else statement.

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

This thread is 6 years old! The OP has probably replaced that old computer by now.

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

I've been working on that very thing the past few days -- learning Windows Forms. You can't call c++ new operator -- instead you have to use gcnew.

private: System::Void toolStripMenuOpen_Click(System::Object^  sender, System::EventArgs^  e) {

             if( openFileDialog1->ShowDialog() == System::Windows::Forms::DialogResult::OK)
             {
                try
                {
                    StreamReader^ myStream;
                    if(openFileDialog1->FileName == nullptr)
                        return;
                    if ((myStream = gcnew StreamReader(openFileDialog1->FileName)) != nullptr)
                    {
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I know it sounds fun to code it in assembly, but you would be better off using your time to learn a higher level language such as c, c++, c#, php, etc. There is almost no need for assembly programmers any more.

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

about cin.ignore() -- read this thread

function arguments are paired by position, not by name.

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

Example:. What specifically don't you understand about it?

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

the problem is that i haven't studied structures in assembly
i am supposed to deal with linked lists

Well you had better get to studying them because that's what linked lists use. In assembly language structures may be also called records.

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

timers -- e.g. SetTime() and KillTimer() -- do not work with console programs because they do not have message pumps.

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

Neither one is selection sort. Read this for an algorithm.
The second one is not a sort of any kind because it contains errors


>>for(i=0;i<=n;i++)

Arrays are numbered 0, 1, 2, ... N-1. So i <= n should be just i<n

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

what operating system? MS-Windows use win32 api function CreateThread(). See these links for examples

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

put that in its own thread so that other processing can be done. In the thread put the code in an infinite loop. Call Sleep(1000) inside the loop so that the thread waiks up only once per second. Also you might want to add '\r' at the beginning of the string. printf("\rCurrent ..."); Hopefully there is no other output in the program because if there is then '\r' won't work because the cursor may be on some other line. You could, nowever, use win32 api console functions to move the cursor to the desired line on the screen.

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

Coding anything in c++ is going to be more complicated than in other languages. c or c++ is not necessarily the best language for doing some things.

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

You use normal win32 api functions to do that. Read this

Open the com port with CreateFile. Scroll down the page to "Communications Resources" for more information. And an example c++ program.

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

Here is a good tutorial about structures in assembly programs

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

To do it as floats, do something like this

float x = 914.419;
float intpart, fractpart;
fractpart = modf(x, &intpart);

int x1 = (int)intpart;
int x2 = (int)(fractpart*1000.0);

Now you have two integers to work with. One problem is that some nmbers can not be represented exactly in memory, so fractpart may or may not be an exact value.

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

Write the web site any way you want to. If you don't want to see "point of sale" then don't put it there.

I don't write web sites, so I can't help you with that. Like I said, you are posting in the wrong forum.

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

>>printf("%d",a[x]);

should be %f, not %d. Also put a space between the numbers printf("%f ", a[x]);

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

>>But i wanted to know if it could be done without using string array or string functn. plainly by using any numeric datatype

Yes. use modf() to split the float into integer and fractional parts. The write a function that adds together the digits of each part. Finally main() should put the two parts back together again into a single float.

You can use / and % operators to extract each digit

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

You can't have nested functions like you posted in red.

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

>>cout << test[5][15][2]; //it will write number one, its ok

No it is not ok. 2 is out of bounds. only 0 and 1 are valid

>> cout << test[5][15][5]; //it should say, that i am off the array size with
// number 5 in depth dimension (program should throw exception), but it
// will write some random number -21598 and doesnt throw any exception,
//that i am looking out of allocated memory

It will not do any such thing as throw an exception at runtime because c/c++ has no bounds checks. That situation has been the thorn in every programmer's side since C language was invented and has been the cause of countless debugging hours. There are several tools like these to help with the debugging.


Try this if you want to see your program crash and burn for (int z = 0; z < DEPTH+10; z++)

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

did you try something like this?

data db 1024 * size node

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

>>For example when I want to read p2DArray[511][511][845646] it doesnt say me that I am out of dimensions

Well duuh! the maximum is p2DArray[511][511][1]. c++ programs don't produce out-of-bounds error messages. They just crash and burn.

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

I assume POS == Point Of Sale. You need to write a web site, not a c++ program. See Web Development forums.

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

Yes it is time consuming. Microsoft does not recomment more than a few threads per process.


How many threads are too many? Maybe you should read this thread. And this one too.

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

>>i dnno how to insert in without using an array

Please explain more exactly. Insert a value into the array?

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

on line 149 you will have to call getline() to read the student name that contains spaces.

If you only want to read the file use ifstream instead of fstream and use >> with ifstream. << is used with ofstream.

inFile>>student[0].studentClass>>student[0].studentBonus;
getline(inFile,student[0].studentName);
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

If you do this then you may no longer be able to use the designer to visually edit the form tht contains all those picture boxes. So set up the form the normal way to make it the way you want it.

You will have to make a lot of changes.

1) declare the array like this: private: array<System::Windows::Forms::PictureBox^>^ pictureBox1; 2) declare a const int for the number of pictureBox objects you want const int MaxPictures = 10; 3) allocate the array

void InitializeComponent(void)
{
            pictureBox1 = gcnew array<System::Windows::Forms::PictureBox^>(MaxPictures);
            for(int i = 0; i < MaxPictures; i++)
                (cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->pictureBox1[i]))->BeginInit();

4) make similar changes throughout the program

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

Post what you tried so that we can help you to correct it.

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

>>How many threads can be created? (I know that if there is too many, they have to wait for their turn, but is there a limit?)

Windows 2000: maximum is 65,535 handles. That will include threads, files handles, GDI object handles, etc. I have not found if XP, Vista or Win7 are any different.

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

Is it an MFC program?

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

try Build-->Clean then rebuild the entire project. Correct all warnings and errors.

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

The code you posted does not contain anything that attempts to read a text file.

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

google for ODBC or ODBC tutorials

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

can you make SquareImage1 to SquareImage64 an array? Then you could do that in a simple for loop. And it might simplify other parts of the program. Image SquareImage[64];

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

>>I am not intended to use "pass the vector by reference" because i am comparing the value of each element to find out the highest frequency count.

That's ok -- it still should be passed by reference to avoid having to duplicate the entire vector. If you had a vector with a million integers in it duplicating that vector would be very very time consuming as well as a lot of unnecessary extra memory. IMO c++ objects should almost never be passed by value.

Use the const keyword to prevent the functtion from changing it.

int highest_range(const vector<int>& match, int& index)
{
    int highest = match[0];
    index = 0;
    int sz = match.size();   
    for (int j=1;j<sz;j++)
    {
         if (match[j]>highest)
         {
            highest=match[j];
            index = j;
         }   
    }
    return highest;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

what exactly do you mean by "it doesn't work"? Compiler errors? If yes, then what are they ?

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

search your computer to see if you have that *.lib file in your tc folder

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

CMyDialog->DoModal()

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

I'd start by googling for "freelance programming"

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

line 10: int big=match[0];
That won't work because its declared as a global and vector match does not contain anything.

>>void highest_range(vector<int>match, string range [])

You should pass that vector by reference, not by value, so that the entire vector doesn't have to be duplicated. void highest_range(vector<int>& match, string range []) You must make that function return an int value instead of void (read your instructions) then move the declaration from line 10 (mentioned earlier) into this function. Also, there is no reason for it to have that second parameter

int highest_range(vector<int>& match)
{
    int big=match[0];

// rest of that function goes here

    return big;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>can you please tell me how to use it in a dialog box.......
Not here -- that topic will fill a book.

When the call button is clicked the program should get the currnt system date/time and save it in a variable. When the end call is clicked the program gets the current date/time and save it in another variable. Then just get the difference and your problem is solved. I would just use the time functions in time.h

>>also if the user's balance is low or about to end, the call[ie the dialog box] should be closed, ie the "end call" button should be automatically activated

You might want to consider using an OnTimer() event handler for that

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

>>can this be done using turbo c?
Probably not.


All you did was post a bunch of java code in the c forum.

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

You don't really close the current dialog --just hide it with ShowWindow(SW_HIDE)

I don't know why you are getting that assert error.

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

When you set up the edit control you told it that you wanted it to be a numeric value by checking the numeric property. When you did that MFC will not permit it to be blank -- it must have a number. If you want it to be blank then go back and deselect the numeric property of the control. Of course when you do that then you can type anything you want in the control. You can control that by adding an event handler for that control which is called on every keystroke (I forget the handler's name) and validate it yourself. You may have to subclass the control in order to do that. Here is a very good tutorial

Hint: Since you are using MFC you might want to bookmark codeproject.com because it has the largest repository of MFC code and tutorials you will find anywhere on the net. I found it to be an indespensible source of MFC information.

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

use an OnTimer() event handler. See SetTime() and KillTimer()