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

Here is the source code to a workable program.

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

You don't need OnMenuSelect(). Just use ClassWizard to implement event handlers just as you do the menu items in the main menu.

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

I want to make a Web browser with c++ within two days. How should i make it

Two Days :-O :icon_lol:

If you use VC++ 6.0 compiler it has CHTMLView that is a web browser which you can implement in just a few minutes. Not sure if VC++ 2005 has it or not, but I suspect it does.

Otherwise -- read the previous posts to this thead and the links they contain!

iamthwee commented: vc++ 6.0 ? -2
jbennet commented: lots of people use VC6 +22
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

ok let me try another way

_o__|_x_|_x__
_x__|_o_|_x__
_x__|_x_|_o__
| |

This is the game i wanted to make

I think everyone over the age of 5 years old knows what tick-tack-toe games are like. I think others here have given you hints how to write the program. No one is going to do your homework for you, so post code and ask questions about how to resolve specific problems.

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

MFC is a horribly badly designed and unreliable library, never ever use this.

Those are fighting-words Mr. :) But MFC is C++, not C so its not relevent to this board and this thread.

>>And better don't rely on windows api, because microsoft tends to change its api, in windows vista it's not any more the same as in the descendants of windows nt, and this change is most likely not the last


You obviously have no clue what you are talking about. Win32 api in Vista is the same as previous versions of MS-Windows -- only enhanced and some additions.

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

PUT THE KEY IN??

I did it 6 times then it got too hard!!

4 times -- then I passed out because I thought I was drunk;)

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

>> any one can help me with code pleas

Yes, start here

int main()
{
    // put your code here

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

QT GUI library is also portable between many (but not all) operating systems. As for compilers -- you will need one for each OS that you want to support. There is no one compiler that will cross-compile for all of them.

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

Some compilers will even let you declare main as returning a pointer! (VC++ 6.0 for example)

char* main()
{
   char* ptr;
   return ptr;
}

But since pointers are really integers the program will actually return the integer value of that pointer. Meaningless -- absolutely. But I've seen someone try to do it.

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

>> why the pointer value is allocated only 4 Bytes
Not necessarily -- depends on the operating system and the compiler. In the days of 16-bit MS-DOS pointers were 2 bytes. On 64-bit MS-Windows pointers are 8 bytes.

The maximum number of nodes in a linked list would be limited only by memory. True, you may not be able to count more nodes than can be stored in an unsigned long integer (on 32-bit computers) but the list could certainly hold many more nodes than that assuming there is enough memory.

The file limits.h gives the maximum values of many objects.

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

Was going to say you must have a pretty big house if you have had computers for 25 years. Not to mention you electricity bill.

Not at all -- desktop PCs were first marketed in 1981

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

Yeah but it sounds like you belive the things that your son tells you when it comes to computers. You have been able to get PC's for 25 years?

25 years might be a streatch -- probably more like 15, but you get the idea. :)

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

To your parent you'll always be the little kid who has to have his diapers changed every few hours.
Better get used to it, they'll still think of you (subconsciously) like that when you're 50 and they're 80 or so.

Yup, that's right. My baby girl is 38 years old and has her own teenagers. My 42-year-old son is a lot more computer hardware savy than I am so he has fixed/built my computers for the past 25 or so years.

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

My first program in 1979 was in HP Basic on a HP computer that had a wapping 64K memory and used 8 Inch (203 mm) diameter glass diskettes to store data. A couple years later we also got a TI 99 programmable calculator that was pretty nice for the time.

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

It's not fine. Enter word: sue followed by a space and enter. You'll see the result of what I have been explaining.

Another experiment -- enter a sequence of characters with no spaces that is longer than the size of the imput buffer and see what happens ;)

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

you can not use switch with strings.

>>word = getchar();
Don't use getchar() is c+++ programs. use cin.get() instead.

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

just the opposite of adding them

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

Ok, here's some help

class SavingAccount
{
// put class objects and methods here

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

>>Go over the string and count spaces
Generally, yes, but you also have to check if words are separated by more than one white space (spaces or tabs). When a white space character is encountered you have to increment the loop counter until the first non-white space character or end-of-string is found before continuing the loop. If you don't, the word count might be wrong.

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

just deleted a thread (spam) and played half a game of solitary before it finished.

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

>>where can i get STL string user guide
here

use transform() to convert a string to upper or lower case, like this:

#include <algorithm>
#include <string>
<snip>
std::string str = "Hello World";

std::transform(str.begin(), str.end(), str.begin(), ::toupper);
Killer_Typo commented: damn your posts are always so informative ! +6
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>Don't want you make mad or anything
Don't worry -- you won't.

>>Could you put it all together in the program
Already did that. Just replace lines 5 thru 12 with the small bit of code I posted. You don't need to change any of the other code you posted.

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

it might work but it could be a little more efficient. Don't need variable months and you don't need that if statement, just the while loop.

Month = Month + nun_months;
while(Month > 12)
{
    Year++;
    Month = Month - 12;
}

Now after that code you need to verify that Day is in range for the given Month.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
class C_String 
{
      public:
             C_String() { memset(array,0,sizeof(array));}
             char* Input();
             void Output( );
      private:
           char array[30]; 
};

>>first time using that kind of stuf and can't find an answere nowhere
you really should get an Introduction to C++ book. All sorts of helpful stuff in the Readme threads at the top of this board.

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

>>How may I clear whole array in that example
code a constructor and use memset() to clear it.

Line 3: conio.h is non-standard file that contains non-standard functions. You don't need it in the code you posted because there are c++ alternatives that are standard -- such as cin.ignore().

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

Its really sluggish this evening (9:43 PM CST) and was pretty bad early this morning too (6:00 AM CST). Using IE7 on Vista Home.

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

scanf() with "%s" (see line 16 of your program), like its cousin gets(), should never ever in this lifetime be used for any purpose Its an evil function that will cripple your program and possibly crash the os. Instead, use fgets() which limits imput to the size of the input buffer.

I don't know if your version works or not (didn't test it) but this probably does.

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

Every resource item must have a unique ID number, both the resource files in your project and resource files in other DLLs. You can use LoadMenu() to load a menu resource that is not normally part of the project. Also read the links here for how to create a shortcut menu.

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

1. Just parse the string. If you already know the time format then it is not very difficult to split the string into its individual parts (hours, minutes, seconds, milliseconds).

2. The milliseconds is not very useful when the time difference is greater than probably one minute. If the difference is less than one minute then just convert both times to milliseconds and subtract them.

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

It is using uninitialized variables -- initialbal was never set to anything. You need to code a default constructur that initializes all variables to 0 or some other known value. Don't assume the compiler will do this for you because it won't.

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

Happy Birthday all you July babies :) I'm February, but my 45 wedding anniversery is today 17 July.

ndeniche commented: happy 45th anniversary!!!! +3
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>Create derived class Saving of a saving account

class Saving : public Bank
{
  // put class objects/methods here
};
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>i need a detail explanation how the program work
I assum then that you did not write that code? If you had then you would know how it works.

What part(s) do you need help with?

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

check_month() is incorrect. November has only 30 days, not 31.

class data objects: I think all you need are current_day, current_month, and current_year. You don't really need any of the others. add_years() for example should be coded like this:

//add years to default date
		void add_years (int num_years) {
		
			curr_year = curr_year + num_years;
			//print 
		
		}//end

You need a loop to add months,

while new months > 12
    increment year
    subtract 12 from months
end of while loop
//Now check the value of day to make sure it does not exceed 
//number of days in the new month so that you don't wind up
// with something like 31 February.
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

what do you mean by "is not working" ?

Doesn't destroyList() set all variables to 0 before returning? Is so then why do it again when otherList.first == NULL?

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

Yes, and its very very complicated. I doubt you will gain anything by doing that, but will probably slow down the program even more because you are adding yet another layer. Probably C# or VBA would be better languages for that.

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

It might also depend on how the compiler implemented cout. Microsoft compilers cout is just a thin wrapper for printf(), that is, both cout and printf() call the win32 api function WriteFile(). I have no idea how *nix compilers implement the two functions.

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

can't you just translate that shell program into c? That is, write a c program that makes the same system calls ?

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

Narue: thanks for the correction :icon_redface:

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

Haha, i thought he ment passing variable arguments.. as you can pass an array as a parameter (using pointers of course), so i thought he ment how do you pass a variable to a function.

Oh well :)

Oh, now I understand the reason for your post. :)

Dear friend , I am asking about a function like printf(). as it takes the variable argument.How can we define a function like this?

Most functions that take a variable number of arguments are declared with at least one real argument followed by three periods, like the code posted by Narue and TkTkorrovi.

printf() does not use the periods because of the format parameter which indicates the number of arguments and their data types.

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

1) What's the OP?

2) didn't want to over complicate things for the guy, as he seems to be just starting out in C, giving him a basic understanding of parameter passing would be more beneficial without talking to him about 'VA'.

That's my opinion anyway.

OP = Original Poster. I thought OP was a pretty common term, but maybe I was wrong. That's what I get for using an anronym.

He asked for variable arguments -- the code you posted did nothing to answer that question. I don't know his experience and neither does anyone else. He must have at least some programming knowledge in order to even ask the question.

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

Code not tested, but see no reason why it shouldn't work. :)
Cheers.

Agree it should work but not the way the OP intended because it does not allow for variable number of arguments.

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

threads.html located C:\boost\boost_1_33_1\doc\html\threads.html (or wherever you installed the boost files) contains a section that explains how to build the library.

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

post complete code -- did you add the lines exactly as I posted it?

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

I think you have to compile the boost libraries before you can use any of them. Did you read the readme and install files?

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

The Singapore system works best: mandatory death penalty for posession of any amount for any purpose, and no silly 20 years sitting in prison while your lawyers try to get you off at the expense of the taxpayer.

Not too long about (maybe 100 years or so) we had similar speed of death penalty -- watch nearly any old american western movie and you will see the bad buy is tried, convicted, sentenced and hanged all in the same day.

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

Not quite. Creationists have some kind of a point, if you consider that God created the world he could have created it in such a way that it would appear to be a few billion year old, complete with fake dinosaur bones.
Remember that creationists hold the belief that God is omnipotent and thus can do whatever he wants and maybe he wants us to believe that the world is a few billion year old even if he wants us to know it was created 6000 years ago.

LOL: Hadn't thought of it quite that way, but I suppose He could have done that as a joke. My personal belief is that we are all just microscopic organisms living in a test tube.

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

My guess is that you do not have the list of directories set up correctly in the compiler IDE. Look at menu Tools --> Options --> Project and Solutions --> C++ Directories and make sure the path to the include directories are correct and includes the path to where you installed the Microsoft Windows Platform SDK.

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


I'm glad I visited the US a long time ago before all this stuff happened, because I doubt I would ever want to visit again whilst it treats all visitors as criminals.

We have to treat visitors that way. Not doing anything is what got us into this situation in the first place -- 9/11 that is. Had we had the more strict security measure that are in place today 9/11 probably would not have happened. Desipte our government's best efforts there are still pleanty of holes in our national security, one of them being the situation with illegal entry via Mexico which no one in Wash D.C. has the intestinal fortitude to resolve. Hopefully the next President of US (in January 2009) will do something about it.

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

Is this supposed to be a C program or VB? I moved this thread into the C board because the code posted in the original thread looked like C code, but maybe I was wrong. Aia's post looks like VB because that's the way it would be coded in VB. If this is about VB then just say so and I'll move it again into the correct board.