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

It would be helpful if you posted the contents of that *.cap file. The code you have posted is a bit confusing to follow, so knowing the file contents will help us help you.

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

does sum1 make a solution for it..???
i m wrkin on DevC++

No. We do not write your program for you, but we will help you write it yourself. Show us some effort, such as post the code you have tried, and ask specific questions about your code. But do no expect anyone here to do your homework for you, that's your job, not ours.

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

shadwickman is right -- we are not here to write programs for people but to help them write their own programs. You will not learn anything if all you do is copy someone else's work.

The first thing you need to do is sit down with pencil & paper and write down all the things your program needs to do. Then start writing a program that accomplishes that list, coding one small part at a time.

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

move lines 20, 21 and 22 up between lines 17 and 18 (outside the loop)

Salem commented: Shortest working answer of the week :) +36
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Its called data validation. After input the program needs to check the variable's contents for correct characters. If incorrect characters are detected then display error.

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

use a loop and validate user input

while(true)
{
   cout << "Enter a number\n";
   cin >> number;
   if( !cin.good() )
   {
        cin.clear();
        cin.ignore(1000,'\n');
        cout << "Error\n";
   }
   else
       break;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Edit: 1000th post, yay :)

Congratulations :) And keep up the good work.

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

Forget about VS97 and upgrade your skills before you become obsolete in the programming market. AFAIK c++ programs written with VC++ 2008 to not require the .NET framework -- its the CLR programs that require it. If you stick with ISO standard C++ and win32 api then your programs should work on older windows platforms.

One more reason to upgrade your skills is that the C++ language as evolved beyond what it was 10 to 20 years ago, and the Microsoft compiler supports the c++ standards a lot better than it did in the VC++ 6.0 and earlier versions.

As for VC97 -- it may not even run on current/future version of Windows. I have VC++ 6.0 too and it has problems running on Vista.

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

Why would you want to use such an old compiler? Get the newest version VC++ 2008 -- the Express edition is free., but it has its limitations, such as no support for MFC.

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

That cartoon is funny, but I don't get its relevance :confused:

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

I'm going to donate my dollar to the Peter King campaign.

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

Example: "g++ -o out.a main.cpp"
If you want that to be executed inside a C or C++ program: system("g++ -o out.a main.cpp");

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

>>cout<<sizeof(b)<<endl;
The sizeof operator (its not a function!) returns the number of bytes occupied by the object. In the case of variable b it is 6 integers and the size of one integer is 4 bytes, so simple math 6 * 4 = 24.

The second one is a little more difficult to explain. If you print out the addresses then you will see that b+0 is the same address of b, and (b+1) is the same address as b[1];

0040FCE8
sizeof(b+0) = 4 0040FCE8 0040FCE8
sizeof(b+1) = 4 0040FCF0 0040FCF0
Press any key to continue . . .

int main()
{
    int b[3][2] = {1,2,3,4,5,6};
    cout << hex << b << "\n";
    cout << "sizeof(b+0) = " << sizeof(b+0) << " " << (b+0) << " " << b << "\n";
    cout << "sizeof(b+1) = " << sizeof(b+1)  << " " << (b+1) << " " << &b[1] << "\n";
}

Using the above program you should be able to figure out the rest.

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

No its not photoship. After printscreen I pasted it into MS-Paint and saved it.

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

A Windows Hook might do it.

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

If you want me disprove that, send me: $40 for rolling papers, $350 for an ounce, and $200 for microbrews.

And that would only prove I'm an idiot for doing that :)

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

I just upgraded and I don't really see any difference, other than there is now a button to open a new tab, like IE8 has.

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

call clock() at the start, then again at the end, and subtract the two.

clock_t t1, t2;
t1 = clock();
// do something here
t2 = clock();
clock_t diff = t2 - t1;
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I assume you mean clock() -- yes, just restart the program.

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

>>I can prove you wrong on that. - MosaicFuneral
Ok smartass, how can you prove that I don't know any programmers show smoke dope. And I'm not the only one who claims smoking pot and programming don't mix. Just read post #9 here -- the pot smokers flunked the programming class.

jephthah commented: you get 'em! :) +12
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

2) The computer speed has nothing to do with srand(). srand() is used to see the random number generator so that it does not generate the same set of random numbers every time you run the program.

4) We are only a little peeved at newbies who want us to do their homework for them. Show us some effort and you will get all the help you want.

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

If you don't want to be here why the hell are you posting ?? Just go away.

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

Looks like its missing a close bracket } at the last line.

What other compiler errors are you getting? What compiler and operating system are you using?

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

I was finally able to get that FileInfo stuff figures out, not by MSCN or google but by IntellSense. So now I can continue on with that tutorial.

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

When I change that I get this warning

1>cl : Command line warning D9035 : option 'clr:oldsyntax' has been deprecated and will be removed in a future release

Then get other errors, such as this one (line 19 in the code shown below).
Form1.h(22) : error C2059: syntax error : 'public'

namespace test5 {

	using namespace System;
	using namespace System::ComponentModel;
	using namespace System::Collections;
	using namespace System::Windows::Forms;
	using namespace System::Data;
	using namespace System::Drawing;
    using namespace System::IO;
	/// <summary>
	/// Summary for Form1
	///
	/// WARNING: If you change the name of this class, you will need to change the
	///          'Resource File Name' property for the managed resource compiler tool
	///          associated with all .resx files this class depends on.  Otherwise,
	///          the designers will not be able to interact properly with localized
	///          resources associated with this form.
	/// </summary>
	public ref class Form1 : public System::Windows::Forms::Form
	{
	public:
		Form1(void)
		{
			InitializeComponent();
<snip>
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Has anyone tried to write this tutorial using VC++ 2008 Express? The article claims to be written with VC++ 2005. But I thought 2005 and 2008 used compatible versions of CLR language. I'm getting all kinds of compiler errors -- for example String* str; instead of using String^ str; and creating objects with new instead of gcnew. The last straw for me was while attempting to implement the section concerning FileInfo class. None of the FileInfo methods Microsoft has in that article work.

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

read this article Seems to me it would be a whole lot easier to use managed streams. Don't ask me how because I have not done it. Something like this article.

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

I was a coder for over 20 years and know no one who smoked marijuana. Tobacco yes, marijuana no. And it makes sense to me -- can't program when stoned or intoxicated.

MosaicFuneral commented: I can prove you wrong on that. -1
VernonDozier commented: Very true. +18
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

merged the two threads.

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

Hurrey! I finally did it :) Only took me about two years or so.

Nick Evan commented: Nice, I'm still trying +21
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Another remark: in nearly all benchmarks, outputting an integer takes longer than a string.

That would be expected because it has to convert int to string before displaying it on the console screen.

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

As you can see between posts #12 and #13 speed not only is compiler dependent but also machine dependent.

But I'm surprised to see that Code::Blocks using MinGW produces faster code than VC++ 2008.

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

GetThreadTimes()

I have not used it and don't know if it will meet your needs. Did you overlook this thread?

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

VC++ 2008 Express on Vista Home Premium with 5 gig RAM 2 Mz CPU, quad core.

Debug build

cout string : 19562 ms
printf string : 6474 ms
cout int : 24368 ms
printf int : 6833 ms
Press any key to continue . . .

Release build

cout string : 18720 ms
printf string : 6115 ms
cout int : 23166 ms
printf int : 6677 ms
Press any key to continue . . .

Code::Blocks V 8.02 release build

cout string : 10671 ms
printf string : 6146 ms
cout int : 11373 ms
printf int : 6645 ms

Process returned 0 (0x0) execution time : 34.873 s
Press any key to continue.

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

I don't understand what's so difficult about thread timing. If you want the thread to quit after a specified amount of time, then just compare current time with original thread entry time and exit when that difference is greater than some pre-determined amount of time.

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

There is no point comparing the difference because such a comparison will be compiler dependent. How one compiler implements cout and printf might be different than how some other compiler implements them. One compiler might wrap cout with printf() while another compiler might wrap cout with win32 api function WriteFile() (in MS-Windows os), bypassing printf() altogether.

tux4life commented: Good point. +12
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You mean like this: Color coding requires the language option in to code tags

#include <iostream>
int main()
{
   std::cout << "Hello World\n";
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

line 34 of the code you posted: In the actual function you have to give the parameter a name, such as void Calculate( double number )

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

pass to function: its just a parameter

int foo(int n)
{
    return n*10;
}

int main()
{
   // This line passes the value 15 to the function foo()
   // and gets the return value in the variable named x
    int x = foo(15);
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>Is the .exe file deployed or a library is created out of the application for deployment?


The exe. Only exe files are run on a Windows operating system -- libraries and DLLs require exe files to run them. Depending on the exe program you may also have to deploy one or more DLLs along with the exe program.

If you want the same program to run on both Windows and *nix you will have to compile them on under both operating systems -- the same binary program will not normally run on both systems. And in some cases that may require major rewrites of the program to port from one os to another.

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

Learn the c++ language first -- don't jump into the deep end of the pool until you know how to swim. A program like you describe will take a firm grasp of the C or C++ language (could be in other languages as well).

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

If that's all you have coded then forget it because your program is missing hundreds of lines of code. See this tutorial.

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

Its the same as any other sort algorithm -- when you need to swap just swap Person pointer in the PersonList structure.

It would be a lot easier to convert the linked list to an array of pointers into the linked list, then sort that array.

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

did you try my previous suggestion yet?

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

You can't just code random variable names and expect the program to work.

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

hEdit is probably a handle to a dialog boxl that must have been previously allocated. It must have been declared and initialized in your program somewhere. I suspect you should not be using hEdit because hEdit is probably an edit box control in that dialog box. Use the HWND that was returned by CreateWindow() (I think that's the function) when the dialog box was created.

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

You will learn a great deal more by writing it yourself instead of trying to copy someone else's work.

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

The problem could also be one of Endianness. The byte order on windows and *nix computers are reversed. Maybe your os is writing the bytes out in reverse order during the copy process. To test that use your system's command-line copy function to make the copy, FTP to Windows and check it with MS-Word.

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

What variables do you want initialized?

>>SendMessage(hwndListBox, LB_GETTEXT, a, etxt[a]);
That's not correct, the last parameter is only passing a single character, not a pointer to a character array. There is how it should be coded SendMessage(hwndListBox, LB_GETTEXT, a, etxt); If you want to keep all the strings in the list box then declare etxt as a 2d array etxt[20][255]; , which is an array of 20 strings, and each string can contain up to 255 characters. If that is what you want then you don't have to change the SendMessage() function as I previously posted.

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

There's a time to smile, and a time to frown. I try to smile all the time while at work as a WalMart cashier and often wear a happy-face sticker on each shirt lapel. I haven't been punched in the face yet for smiling :)