15,300 Posted Topics

Member Avatar for JoBe

I have had the same question about how to disable UNICODE settings -- thanks WolfPack for the help. But even after that, I also get the unresolved external MessageBox error. Can't it be used in console applications?? I use it in console apps with VC++ 6.0 compiler without any problems. …

Member Avatar for WolfPack
0
668
Member Avatar for hak

start at the beginning, not somewhere in the middle of things.[URL=http://www.winprog.org/tutorial/]Here[/URL] is a good tutorial to get you started.

Member Avatar for bumsfeld
0
202
Member Avatar for comwizz

one place a reference is needed and pointers will not work is overloading the [] operator. You couldn't implement this [b]as neatly[/b] using pointers. And the reference can be used on both left and right side of the operators, as illustrated in main() below. [code] #include <iostream> using namespace std; …

Member Avatar for Bench
0
157
Member Avatar for squall8985

you will probably want to truncate all trailing spaces first before using Narue's solution. Otherwise it will not work if the line is like this [code] "1 John US 1234.00 "[/code]

Member Avatar for Narue
0
256
Member Avatar for Jon182

here is one way to do it. It just has the string hard-coded, but you should be able to easily make it work with data file. Also assumes int is at the beginning of the string -- you should be able to change it to recognize int in the middle …

Member Avatar for Jon182
0
451
Member Avatar for jhdobbins

when you press 'y' followed by <Enter> key, there are two keys in the keyboard buffer -- so the second time through the code it is probably getting the '\n' key. you need to flush the keyboard buffer to remove the '\n'. [code] scanf("%c", &yorn); getchar(); //flush the keyboard buffer …

Member Avatar for Ancient Dragon
0
251
Member Avatar for pit_bull

I don't know how you posted that code, but you should have use simple code tags. Please edit your post to use code tags. [ code ] // code goes here [ /code ] just remove the spaces between the square brackets. unless you are using a very very old …

Member Avatar for agiorgio
0
110
Member Avatar for brianotieno
Member Avatar for dwks
0
139
Member Avatar for Whodey

does it work the way it is intended? If yes, then why fix something that ain't broken? But its obvous that it doesn't do what you want it to do. What kind of [b]database[/b] are you supposed to use? MySql, MS-Access, simple flat-text file? or something else?

Member Avatar for Whodey
0
131
Member Avatar for caseg

did you really write that program? or did you just copy it from somebody else? Look closely and you will see that it is printing the same thing over, and over and over one each iteration. But of course you already know that if you had written it youself :rolleyes:

Member Avatar for Whodey
0
145
Member Avatar for tyczj

use braces to encose blocks of code. The below may or may not be what you intended. [code] for(int d=0; d<DEPTH; d++) { for(int r=0; r<ROW; r++) { array[d][r] = **this for(int c=0; c<COL; c++) { array[d][r][c] = cells.array[d][r][c]; } return *this; } } [/code]

Member Avatar for tyczj
0
167
Member Avatar for Mike182

there is no such thing (keywords) as [b]function script[/b] in either c or c++. maybe in managed c++ (I don't know managed c++), but VC++ 6.0 compiler doesn't know how to compile managed code.

Member Avatar for Ancient Dragon
0
333
Member Avatar for rasheed1982
Member Avatar for apcxpc

erase the window -- get current window RECT object then call FillRect() with the desired color.

Member Avatar for Ancient Dragon
0
208
Member Avatar for javamum
Member Avatar for javamum
0
99
Member Avatar for magikman

since this is a c++ program, use std::string instead of char arrays. std::string is a lot easier to use. [code] struct Node { std::string Descrip; double Price; int Quant; Node *Link; }; ... void InsertFunction(char *InitDescrip, double InitPrice, int InitQuant, Node *Current) { [color=red] Current->Descrip = InitDescrip; [/color] Current->Price = …

Member Avatar for Rashakil Fol
0
497
Member Avatar for anupam_smart

different calling conentions are needed for mixed languge programs -- mixing C, Pascal, Basic etc in one program.

Member Avatar for Ancient Dragon
0
119
Member Avatar for winbatch

[URL=http://www.boost.org/libs/numeric/interval/examples/newton-raphson.cpp]boost[/URL] may have one. search that link for the word intersect and see how it is used.

Member Avatar for Narue
0
125
Member Avatar for rgrwalker

since finalgrade class does not use any c++ std containers such as std::string you can write the entire class in one statement. put this in main() [code] ofstream out("file.dat", ios::binary); if( out.is_open()) { out.write(Students,sizeof(Students)); out.close(); } } [/code] and to read it back is just as simple [code] ifstream in("file.dat", …

Member Avatar for Ancient Dragon
0
137
Member Avatar for Jon182

>>it is at the start or previous character is whitespace but i also need the or comma clause. just add more || operators on that line! [code] if( ch == temp || isspace (*(ch-1)) || *(ch-1) == ',') [/code] or you could use a switch statement [code] switch(*(ch-1)) { case …

Member Avatar for Ancient Dragon
0
233
Member Avatar for rgrwalker

what doesn't "work promperly" ? compiler errors? runtime errors? if yes, post them.

Member Avatar for rgrwalker
0
242
Member Avatar for Whodey

what do you mean "convert it over" ? from what to what? What problems are you having? you need a more detailed description of your problem(s)

Member Avatar for Ancient Dragon
0
129
Member Avatar for Jon182

why do you think it is incorrect? Is the char count supposed to include spaces and periods? How about end-of-line terminating characters? Why not consider question mark ? and exclaimation point! as end-of-sentence terminators/

Member Avatar for Jon182
0
71
Member Avatar for comwizz

your program is littered with uninitialized pointers! set all pointers to 0 when declared and it will make your debugging a lot easier. Replace all those pointer arithmetic with normal array indexing. Make sure the program allocates memory before using it. [code] // replace this *(a+j)=new char*[w_len]; // exception attemtping …

Member Avatar for HackWizz
0
355
Member Avatar for khot_anuradha

open the file, seek to end, the get current file position. How to do that depends on C or C++. There are also other ways, such as stat(), win32 api GetFileSize(), and others.

Member Avatar for agiorgio
0
368
Member Avatar for JoBe

is record.name a std::string object? If it is, I might be wrong but I don't think you can do binary reads and writes like you are doing with that string because all that is getting read/written is the number of bytes in the class itself -- the string is not …

Member Avatar for JoBe
0
205
Member Avatar for stackOverflow

That identical set of questions has been posted before. google for the first question and you will find the answer(s).

Member Avatar for Bench
-1
318
Member Avatar for niceguy21
Re: help

[QUOTE=niceguy21]how can i remove my username from this list if i want to[/QUOTE] pm Narue and I'm sure she will be happy to ban you if that is what you want.

Member Avatar for Ancient Dragon
0
90
Member Avatar for HackWizz

what compiler (and version) are you using? What is (are) the error messages? after including the C++ stl header files you need to declare the namespace [code] #include <iostream> ... other header files here using namespace std; [/code]

Member Avatar for HackWizz
0
210
Member Avatar for perlsu

data = &flag; that is incorrect. data is a pointer to a variable inside main(). If you want to change it, then you need to do something like this (typecast data to int pointer) *(int*)data = flag; That should fix the immediate problem, but then you need to add code …

Member Avatar for Salem
0
176
Member Avatar for amen

there are methods of sorting text files, but they are generally pretty complicated. If the file is small enough, just read all the strings into an in-memory array, sort the array, then rewrite them back to the file. If you are writing c++ program that is pretty easy -- read …

Member Avatar for Ancient Dragon
0
110
Member Avatar for Jon182

write a function to test the string to see if it contains only numeric digits. Fucntion should return true if the string contains only numeric digits or false otherwise.

Member Avatar for Jon182
0
158
Member Avatar for cppbeginner
Member Avatar for crusty_collins

are the argv[] strings in read-only memory? Maybe you need to copy the string to a temp buffer and use strtok on that temp buffer.

Member Avatar for crusty_collins
0
341
Member Avatar for nemo

you can't. Like the book says, derived class inherits ALL members of the base class. But, what you can do is make members of the base class not accessible to members of derived class by making base class members private. In the code below, class derived cannot access variable x …

Member Avatar for nemo
0
109
Member Avatar for server_crash

>>f it was, Narue, can you explain the reason atoi() is bad There is very little "bad" about atoi() -- you were using it incorrectly. It does have one problem in that it does not detect integer overflow. If you are going to use a function and don't really understand …

Member Avatar for Narue
0
1K
Member Avatar for Kilo

1. where is [b]menuItemList[/b] object declared? 2. why all those useless lines that access the structure but does nothing with them? For example: menuItemList.BaconandEggs; If it is supposed to be setting them to 0 -- it doesn't.

Member Avatar for Bench
0
143
Member Avatar for bops

If you are running Norton Antivirus turn it off during development. Sometimes it causes problems like that. Don't forget to turn it back on when you are done.

Member Avatar for WolfPack
0
396
Member Avatar for amen

set a boolean flag to indicate if the word is found in one of the two files. If not set then it must be a noun. Something like this sudo-code. Note: search second file ONLY if the word is not in the first file. [code] set flag to false search …

Member Avatar for amen
0
543
Member Avatar for jack223

The clues in the question are [b]modify data[/b] and [b]++ptr[/b]. Both these need non-constants. So the only possible answer is a).

Member Avatar for jack223
0
120
Member Avatar for kryptolite

[code] std::string isbn; getline(fin,isgm); [/code] if you want to read them all into an array [code] std::vector<std::string> isbn_list; std::string isbn; while( fin >> isbn) isbn_list.push_back(isbn); [/code]

Member Avatar for kryptolite
0
130
Member Avatar for sixtysecasasin

1. please use code tags when posting a lot of code. 2. you forgot to ask a question. Or did you just want us to see your gorgeous code?

Member Avatar for Ancient Dragon
0
135
Member Avatar for Jon182

when you enter the filename from the keyboard do not use double backslash -- double slashes are only needed for string literals in your program. So you should type [b]c:\fred.txt [/b], only one backslash. Reason: the compiler does not interpret anything you enter from the keyboard, it only interprets string …

Member Avatar for Jon182
0
171
Member Avatar for perlsu

what compiler are you using? I just tried it with VC++ 2005 Express and had no problems.

Member Avatar for Ancient Dragon
0
131
Member Avatar for muthuivs

[code] #include <string> #include <iostream> #include <algorithm> using namespace std; int _tmain(int argc, _TCHAR* argv[]) { string myString ("abcd"); [color=red] transform(myString.begin(),myString.end(),myString.begin(),toupper);[/color] cout << myString << endl; cin.ignore(); return 0; } [/code]

Member Avatar for beuls
0
253
Member Avatar for muthuivs

You can use the printer's device driver and win32 API [URL=http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/prntspol_9qnm.asp]OpenPrinter[/URL] and associated functions. (Scroll down to the bottom of the page and you will find other links).

Member Avatar for muthuivs
0
2K
Member Avatar for xjim72

1. put all the numbers in an array and short it. 2. create a 2d array, the first dimension contains the number and the second dimension contains a count of the number of times the number appears. The program will have to iterate through the original array (#1 above) and …

Member Avatar for xjim72
0
888
Member Avatar for sosy2001

[quote]Can someone tell me if its correct?[/quote] why do you need someone to tell you that? You can do it yourself just by running the program. Does it do what it is supposed to do? Yes, then it is correct. No, then you need to rewrite parts of it.

Member Avatar for dwks
0
131
Member Avatar for fevershark

you can allocate a class just like you did for that array [code] class MyClass { // blabla }; int n = 5; // allocate an array of class objects MyClass* pClass = new MyClass[n]; // // allocate only one class object MyClass* pClass = new MyClass; [/code]

Member Avatar for dwks
0
146
Member Avatar for Acidburn

The End.