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

I get those similar warnings too -- just ignore them.

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

When you open the com port with CreateFile() you can specify a callback function that MS-Windows will call when data arrives at the port. That way you don't have to keep polling it to find out if there is data.

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

I would make table a vector instead of array of strings so that it can hold as many strings or as few as you want. vector<string> table; . IMHO that hash line is probably much less efficient than just adding the new string to the next available slot in the array. For example if you input two strings that are the same length then that hash function will produce the same array index and the second string will overwrite the first.

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

The way to communicate through com1 will depend on the operating system. MS-Windows, use CreateFile() to open the com port, then ReadFile() and WriteFile() to read/write to it. See commuications functions for more details.

I don't know a thing about ladder logic because I never programmed a PLC.

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

Since you have to switch compilers anyway why not switch to one that is completely free for you to use as long as you want to use it? Code::Blocks with MinGW compiler and VC++ 2010 Express come to mind -- there are others too. Of course you may have to update your Paradox database engine if you are still using the same on you got in the 1990s. The newer engines support ODBC which can easily be used on any modern compiler and on Windows 7 too.

There are lots of information on the net about how to use ODBC in your c and c++ programs. There are even a couple free c++ classes. Just use google and you will find them.

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

Didn't you bother to read any of the links that Salem posted?

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

Where does the error occur -- such as what line number?

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

That warning means that std::string.size() returns an unsigned int, so line 29 is comparing an int to an unsigned int. The work around is to declare variable i as size_t, not int (assuming your compiler defines size_t as unsigned int). for( size_t i = 0; i < /* blabla */ . And that makes perfect sense because the length of a string can never be negative, so why bother using a loop counter that can be both netative and positive values? Also using unsigned int instead of int lets std::string have a lot larger strings.

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

First problem: what is your program going to do if I enter 50 characters? You should try that.

Second problem: The for loop on line 8 is incorrect. for(int i = num1; i <= num2; i++)

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

I ran this short test on VC++ 2010 Express and Code::Blocks

int main()
{
    if ( -1 < ( unsigned char ) 1 )
        printf("true 1\n");
   if ( -1 < ( unsigned short ) 1 )
        printf("true 2\n");
   if ( -1 < ( unsigned int ) 1 )  
        printf("true 3\n");
   if ( -1 <  1 )
        printf("true 4\n");
}

and got the following results

true 1
true 2
true 4
Press any key to continue . . .

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

There are two ways to install Code::Blocks -- just the IDE itself or the IDE with MinGW compiler. If you look in the Code::Blocks install directory there may be a MinGW directory. If there is, then you have installed Code::Blocks with MinGW. If MinGW directory is not there, then look in c:\ root directory for it. If you find it there then most likely you have installed MinGW independently of Code::Blocks, and in that case you will want to reinstall MinGW again.

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

You might also have to reinstall the compiler that you are using. Code::Blocks is just an IDE that can work with several different compilers.

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

>>I need to take 2 char strings (6 character date) (and (8 charachter operatror id) convert to uin32

Are you talking about converting from ansi to unicode strings? e.g. from char* to wchar_t* ? Here is a 4-year-old thread, but still relevant.

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

I use Windows 7 and Code::Blocks works ok on my system.

Uninstall CodeBlocks, use Windows Explorer to delete the install directory so that there are no traces of it on your computer, then download it again and reinstall it.

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

use a registry cleaner?

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

Where is your function diff()?

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

>>So is it worth learning win32 API instead of just shooting straight to Microsoft Foundation Classes?

Absolutely. That will give you a lot better understanding of what's going on in the background. It's MFC that is rusty and outdated, not win32. You would probably be better off learning Forms and C++/CLR than MFC.

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

Yes you are right -- I had the 25 and 80 turned around. But the same problem still occurs. Take the first string "Terminal". Your program will copy that string starting in the 10th position of Table[0], e.g. Table[0][10]. What do you intend to do with the first 10 characters of that row?

>>and any spaces in between them
There are no spaces between them because you didn't put any there.

To answer your specific original question, you have to pass addresses to strc py() strcpy(&Table[0][i],szLocations[y]); -- Note the use of the & address operator before Table.

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

Pass by value just means that the function receives a copy of the integer, while pass by reference means that the function receives a pointer to the integer. Your text book should explain the difference. You can also find explainations by using google.

In the diff function, the first two parameters are passed by value, while the third is passed by reference. For parameters passed by reference, any changes that diff() makes to the referenced integer will be made to the calling function's integer.

The requirements you posted want you to write a function with three parameters. You was pretty close in the code you first posted -- just needed to add that third parameter. void diff(int a, int b, int* answer)

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

you declared citizenA twice in main().

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

You dont' need that array of the alphabet.

The algorithm is very simple -- just subtract any letter from 'z' and you will have its index. For example, ('Z - 'A' + 1) = (90 - 65 + 1) = 26. You can see how I got those numbers by looking at any ascii chart, such as this one.

So in your program, convert the string to either upper or lower case then do the subtraction in the loop

for(int i = 0; i < len; i++)
{
   cout << string[i] << " = " << 'Z' - string[i] + 1 << '\n';
}

Note that the above will need to be a little more complicated if the string contains non-alphabetical characters, such as numeric digits '0'-'9' or other charactgers.

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

The problem with that algorithm is that you can easily create a buffer overrun with it. Each row of Table can only hold 24 characters plus null terminator. Yet your program is attempting to copy a string potentially 19 characters long into the 19th position of Table, meaning that there is only room for 5 more characters in Table. The first 18 characters of Table would remain unused.

I think you need to re-read the assignment. My hunch is that you have the instructions wrong.

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

That sounds about right from what I recall of the 16-bit MS-DOS operating system.

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

What's an FA ? The boost c++ library has reg exp functions.

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

You could write the higher level programming language in any human language you want. Whatever human language you want to use would have to compile down to whatever assembly language is used on the target computer. That shouldn't be a proglem either unless you want that assembly language instruction set to be written in something other than English.

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

>> grid[j] =='.';

You used the wrong operator. Use the = operator, not the boolean == operator. grid[i][j] = '.';

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

You need to initialize the array with all '\0' before doing anything.

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

Move line 25 out of that class. srand() should be called only one during the lifetime of the program. I normally put it near the beginning of main().

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

I think the problem is fixed now.

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

Depends on the operating system. The two that I am aware of both send keystroke messages to your program when a key is hit. They also send mouse events when the mouse is moved. you probably need to study a tutorial about how to write gui programs. Here is a very good tutorial for MS-Windows.

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

Anyone else getting this error?

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

Did you try commenting out that DrawString() function? It is probably erasing the contents of the line just above it.

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

>>page 1->Show(this);
Remove the parameter. Just this: page1->Show(); I created a Forms application that contained two forms and this worked for me

private: System::Void button4_Click(System::Object^  sender, System::EventArgs^  e) {
    Form2^ f = gcnew Form2;
    f->Show();
         }
};
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>visual C++ 2010 Express edition, which is a trial one
No it isn't. Its free to use for as long as you want and you can use it for both commercial and non-commercial purposes. There's nothing trial about it, at least not in the sense that the trial period expires.

What exactuly to you mean "from one page to another page" ? Do you have a Forms application that contains a button? Your question is very ambiguous.

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

Learn to use your compiler's debugger and you will find the problem a lot quicker than 6 hours! You should probably be able to find it in just a few minutes. Using the debugger you can execute the program one line at a time so that you can see exactly the order of execution and the value of all variables. It might take a while to learn the debugger but it's well worth the effort in the long run.

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

shouldnt his char array be defined as something like char script[2][50] or do i have it backwards?

No. The declaration is ok. What he declared is an 2d array of pointers.

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

The instructions say that there must be three parameters to the function, not two. The third parameter is passed by reference.

int main()
{
   int num1, num2, result;
   num1 = 1;
   num2 = 2;
   diff(num1, num2, &result);
}

The diff() function should do nothing more than calculate the difference. Move those prompts and scanf() into main().

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

Then most likely what you want is this: void display(employee &emp,double pay,double nysTax,double fedTax,double netPay){ Since structure employee contains a several arrays and two doubles you only have to declare the employee parameter once. That is going to pass a reference to the entire structure, not just a given member variable.

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

>>// Why do we need to return a reference
That isn't returning a reference, but a complete duplicate copy of the class. If you want it to return a reference then you need to change it like this: rational& operator= (rational num)

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

most likely the problem is line 66. The value of variable a may exceed the number of rows in the array script. Count the rows in that array -- there are only 5. But the value of a can be as much as 9. Most likely the same problem with all those other variables.

Salem commented: An obvious truth that has yet to be recognised by the OP +20
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The function prototype is incorrect. The first three parameters should be char*, not employee. The first three parameters in the function implementation are also incorrect. Change them to char* instead of employee.

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

The procedure for submitting tutorials is to PM Davy (Happygeek) with the tutorials. There is no other way to do it at the present time.

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

@Joey: I was thinking indexes as Adak suggest would not be allowed either. If its ok, then that is the best way to go.

@Adak: I think you've overcomplicated the program. Just copy the contents of arr1 into arr3, then the contents of arr2 into arr3 where arr1 left off. Two integers are needed, one for arr1/arr2 and the other for arr3. No need to check of the length if arr1 and arr2 are the same or different.

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

Why does it require such complicated code just to raise b^e using iteration? It's just a simple loop. Work the math out on paper then code it. You don't need % or / operators. Just * operator and a simple for loop without those if statements.

>>i want to perform the power with order ( log n ) and order (1).
My solution may or may not meet that requirement.

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

>>read two arrays of chars
Read them from where? the keyboard? a data file? sockets? serial rs232 port?

I know of no way to do that assignment without using either pointers or fucntions in string.h. Maybe you misunderstood the assignment. If not, then you should get a different teacher.

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

line 22: drop the gets() because its very buggy. In c++ programs you should be using cin.getline()

>>Then you should do the reading with the >> ifstream operator instead of .read and the << ofstream operator instead of .write

The file is a binary file, not a text file. So read() and write() are appropriate functions for binary files.

The last loop is incorrect. And use c++ cin.get() instead of getch()

while( f2.read((char*)&e,sizeof(emp)) )
{
 cout<<e.desig<<"  "<<e.name<<"  "<<e.sal << '\n';
}
f2.close();
cin.get();
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

you have to use setw(2) and setfill('0') in the cout statement cout << setw(2) << setfill('0') << minutes << '\n';

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

Post the code You wrote. Nobody here is clairvoyant. My guess is to put the code you need in the form initialization function.

BTY: That looks like a very good youtube tutorial :)

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

yeah, seems like everything gives five points.

tell me something that doesnt give five points.

The point system is stated in the Rules. Suggest you read them.

jephthah commented: lulz. got me. +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Well, silly, you have to remove the else too! You can't just blindly move code around without first thinking about what you are doing. Change that else to an if statement as I mentioned previously.