15,300 Posted Topics

Member Avatar for Likezo

>>Please help the new programmer Well, if you are really new then you need to start at the beginning, not with some really difficult program. Read the [b]Read Me[/b] threads at the top of this board and you will get lots of help and places to look.

Member Avatar for Likezo
0
133
Member Avatar for amarnath.dasari

First, make sure the destination string is NOT a string literal, and that the size of the destingation string buffer is large enough to hold both strings. Once you know that, then find the end of the destination string and copy the source string at that spot one character at …

Member Avatar for Ancient Dragon
0
84
Member Avatar for jireh

>>a sample program of c++ that uses a database There are several alternative ways to do it, all somewhat complex and require a confortable knowledge of C or C++ language.. The most common approach is ODBC, and you can find a few free c++ ODBC classes -- just do a …

Member Avatar for jireh
-2
168
Member Avatar for ecntrader

[quote]Write a program segment with a [b]do-while loop[/b] [/quote] your program does not do that. You used a [b]while[/b] loop, not a [b]do-while[/b] loop. Otherwise the rest of your program looks ok.

Member Avatar for ecntrader
0
6K
Member Avatar for dblbac

pretty simple actually -- replace [b]cout[/b] with an ofstream object. You have already included all the necessary header files so all you have to do is declare an ofstream object at the beginning of the program and use it instead of cout wherever you need to.

Member Avatar for dblbac
0
116
Member Avatar for pacman326@gmail

[b]chooseNumber()[/b] only permits the player to enter a value between 1 and 9. Yet the matrix is 15x12. Why the difference ? 1 and 9 are the values in the cells, not the matrix size.

Member Avatar for pacman326@gmail
0
149
Member Avatar for locy

like [URL="http://www.daniweb.com/code/snippet87.html"]this ?[/URL]

Member Avatar for locy
0
73
Member Avatar for cwarn23

read the [b]INSTALL[/b] file and it will tell you that they used VC++ 6 and NASM assembler. [quote] 2.a/ Requirements. ------------------ - MS VisualDev 6 Processor Pack 5 or MS VisualDev 7 - nasm installed as 'nasm' in the msvc binary search paths. [/quote]

Member Avatar for Kocmotex
0
513
Member Avatar for twooften

>> am a newbie to the C++ arena attempting to write a windows program is NOT a good way to learn c++ language because it is too advanced. Start with something a lot simpler and work your way up from there.

Member Avatar for twooften
0
1K
Member Avatar for Max_Payne

depends on how variable [b]crap[/b] was defined. If its a character array [inlinecode]char crap[255];[/inlinecode] then you are right. But if its a std::string then jamthwee is right. And jamthwee shows the prefered c++ method.

Member Avatar for Max_Payne
0
145
Member Avatar for The Dude

If a guy marries his granny does that make him his own grandpa? Actually I think such a marriage would be legal in USA because the woman is probably beyone the child bearing age.

Member Avatar for twomers
0
113
Member Avatar for teppuus

The problem is in Read_File, you have to pass listTop pointer by reference so that Read_File() can change the value of the pointer that was created in main(). [code] void Read_File(resident *[color=red]&[/color] listTop, int &residentCount) [/code] Next problem with that function -- delete the declaration of [b]listTop[/b] at line 47 …

Member Avatar for teppuus
0
162
Member Avatar for pri_skit

you wrote it wrong -- what you wrote is the c++ class object, not the string contents. If the file is a normal text file where '\n' is line terminator then you need to tack on the '\n' to the end of the string then write only the string to …

Member Avatar for pri_skit
0
121
Member Avatar for phylon

Here is one way to do it -- first read the entire line into a std::string object then parse it [code] int _tmain(int argc, _TCHAR* argv[]) { vector<string> sList; vector<float> fList; string name; float f; string line = "X = {1.0, 2.0, 3.0}"; // extract the name which size_t pos …

Member Avatar for Ancient Dragon
0
185
Member Avatar for Max_Payne
Member Avatar for ithelp
0
124
Member Avatar for The Dude

Yes I agree it is pretty good, and I don't normally like anything written before about 1950 :)

Member Avatar for flo-0001
0
88
Member Avatar for rogenie

you probably didn't initialize [b]totalNumber[/b] when declaring it [code] int totalNumber = 0; [/code]

Member Avatar for rogenie
0
161
Member Avatar for 51al

consider moving lines 10 thru 12 to the top of the program, above line 1. Traditionally include files go at the top of the programs and everything else follows. Sometime its a lot more than just [b]tradition[/b] but a requirement :). Without knowing more about what your program is supposed …

Member Avatar for Ancient Dragon
0
74
Member Avatar for phylon

I don't really know, but did you try the obvious ? [code] for(i = 0; i < 4; ++i) { for(j = 0; j < 4; ++j) { data[i][j] = gsl_matrix_column(i, j); } } [/code]

Member Avatar for dwks
0
140
Member Avatar for redaqen
Member Avatar for redaqen
0
137
Member Avatar for The Dude

If you are unmarried and/or have no children to support then you don't need credit cards. But if you live in USA you will eventually join in the Great American Dream and get up to your eyeballs in debt. Almost nobody lives in this country debt-free and credit-card-free.

Member Avatar for Lardmeister
0
242
Member Avatar for Ancient Dragon

I'm glad to see that you added the "Toggle Plain Text" to normal code tags (those without a language specified). Thanks for making that change :)

Member Avatar for thunderstorm98
0
116
Member Avatar for noona

dont't declare it with [b]const[/b] keyword. A class object declared like that is pretty useless.

Member Avatar for Narue
0
97
Member Avatar for loimarie

Depends on what operating system you want to use. If MS-DOS version 6.X or earlier then you need to make it a TSR. There is quite a bit about that on the net, just google for it. MS-Windows doesn't use memory resident programs like that. It uses DLLs and device …

Member Avatar for Ancient Dragon
0
134
Member Avatar for ambjorn

>>but using the random number generators rand(), which I understand is not a very good idea why not ? >>but I have NO idea how define it in my class declare it as [b]static[/b] and there will only be one instance of it for all instances of your class.

Member Avatar for Ancient Dragon
0
121
Member Avatar for toncoolx

you need to repost your program because your original code will not produce that output.

Member Avatar for Ancient Dragon
0
9K
Member Avatar for conan19870619

If you want to store mixed data than I'd use a structure that has two members: (1) a union between all the data types you want it to support, and (2) an int that indicates what kind of data is stored, such as 0 no valid data, 1 is an …

Member Avatar for Ancient Dragon
0
113
Member Avatar for cloudet

Here is an example of one way to construct those filenames [code] #include <iostream> #include <string> #include <sstream> using namespace std; int main() { string st1 = "file"; string ext = ".txt"; string filename; for(int i = 1; i < 10; i++) { stringstream ss; ss << i; filename = …

Member Avatar for Ancient Dragon
0
5K
Member Avatar for toolmanx

[QUOTE=toolmanx;453051]I didn't want to fill up a thread with a bunch of code, but I couldn't find a way to attach a file to an e-mail using this site's "send a message" system. I would have inserted the .CPP file. [/quote] Hit the [b]Go Advanced[/b] button then scroll down the …

Member Avatar for toolmanx
0
133
Member Avatar for pri_skit

My GUESS is yes -- here is an [URL="http://www.codeproject.com/combobox/CustomListBox_Article.asp"]example tutorial[/URL]

Member Avatar for Ancient Dragon
0
71
Member Avatar for venomlash

I just downloaded the source and compiled with VC++ 2005 Express with no problems using the project that was supplied with the source code. Is it the GLUT source code that you compiled or some file that you wrote? >>I had to install the *.h, *.o, and *.dll files by …

Member Avatar for Ancient Dragon
0
164
Member Avatar for Fredszky

just remove the "%s" -- its not necessary because [b]adress[/b] is already a string that contains the filename [code] file=fopen(adress,"a+"); [/code]

Member Avatar for Fredszky
0
103
Member Avatar for pri_skit

For database support you can use [URL="http://www.google.com/search?hl=en&q=adoce"]ADOCE[/URL] from C and C++ programs. The DLL is installed with eVB compiler. It gets the data from a server computer and stores it on the wireless device that it is running on. As you are finding out (or have already found out) the …

Member Avatar for Ancient Dragon
0
91
Member Avatar for coolbreeze

>>Enter Your Height In Feet And Inches: 5 4 use two variables, not one, something like this [code] int feet,inches cin >> feet >> inches; [/code]

Member Avatar for WaltP
0
125
Member Avatar for restrooms

line 21 is a syntax error that your compiler should have complained about. Maybe its just a posting error ? After using scanf() to get an integer, scanf() leaves the '\n' in the keyboard buffer so the next time you call scanf it will appear as if it is not …

Member Avatar for WaltP
0
137
Member Avatar for toncoolx

A couple ways to solve your problem: 1. after opening the file call [inlinecode]seekp(ios::end); [/inlinecode]set the file pointer to end-of-file before writing 2. Add the ios::ate flag to the open statement: [inlinecode]fout.open("library.txt", ios::out | ios::ate);[/inlinecode]

Member Avatar for toncoolx
0
222
Member Avatar for corruptsystem

when you open the output file add the ios::ate flag so that the open function will move the file pointer to the end of the exting file data after it opens the file. Normally the file pointer is set to the beginning of the file and if you don't use …

Member Avatar for corruptsystem
1
190
Member Avatar for teppuus

The open function does not take std::string object but a char*, so call its c_str() to get it [code] inFile.open(RES_FILENAME.c_str()); [/code] [edit]what Dave said ^^^^[/edit]

Member Avatar for teppuus
0
119
Member Avatar for locy

Oh I see you are back [URL="http://www.daniweb.com/forums/thread93200.html"]to your old code again[/URL] ? >>fehler what is that? Please write in English on these boards.

Member Avatar for Aia
0
98
Member Avatar for step2stepgirl

>>i can't call any function in the main (don't know how) almost identical to calling any normal function except you have to reference the name of the object. For example if you want to call [b]search_By_Id()[/b] then do it like this [code] obj.search_By_Id(); [/code] [b]setName()[/b] is wrong. since [b]Name[/b] has …

Member Avatar for Ancient Dragon
0
136
Member Avatar for HLA91

Unbelievable. 75 posts and you still don't know how to format your code ! I certainly hope you do not plan to turn in that to your instructor.

Member Avatar for Narue
0
180
Member Avatar for Duki

they are indeed different because one is an array and the other is not -- their size has nothing to do with it.

Member Avatar for Narue
0
116
Member Avatar for Exsiss

[b]getchar[/b] uses round parentheses not square brackets to hold the parameters. you don't need the [b]&[/b] address operator on line 26 because arrays are ALWAYS passed by address. line 28 has a couple problems: if you only want one character then use "%c" instead of "%s". and it has the …

Member Avatar for Narue
0
316
Member Avatar for nhlagumbi

depends on the operating system. [URL="http://msdn2.microsoft.com/en-us/library/ms724381.aspx"]Here is some info[/URL] for MS-Windows. You'll have to do some more reasearch to find other information. And why use assembly if you don't have to? A lot easier in other languages such as C or C++.

Member Avatar for Ancient Dragon
0
119
Member Avatar for anirudhbsg

[QUOTE=anirudhbsg;452347]that this lib file is there along with other file in the path that i have specified in directories path option[/QUOTE] If you mean the PATH environment variable then that is incorrect. The compilers I have used from the command-line all use the [b]-L[/b] option to specify path to libraries …

Member Avatar for Salem
0
85
Member Avatar for jrice528

>>the teacher said it should only contain one lineof code. [code] int flip() { return rand() % 2; } [/code]

Member Avatar for ndeniche
0
107
Member Avatar for toncoolx

instead of getline() you could use the >> extract operator [code] string name; int number; int line_count = 0; while( myfile >> name >> number && line_count < x) { ++line_count } [/code]

Member Avatar for toncoolx
0
105
Member Avatar for EOTF

line 29 is wrong [code] while( fgets (buffer , 20 , pFile) ) { // blabla } [/code] fgets() normally adds the '\n' that is in the file at the end of the input string that you need to strip off. And it would make your life a lot easier …

Member Avatar for Ancient Dragon
0
98
Member Avatar for DemonSpeeding

If you want to keep all existing values in the array then you need use a loop to shift everything down from the spot you want to add the new value. [edit]^^^ what Narue said [/edit]

Member Avatar for Ancient Dragon
0
105
Member Avatar for Ancient Dragon

We've all heard about people having guts or balls. But do you really know the difference between them? In an effort to keep you informed, the definition for each is listed below... GUTS - is arriving home late after a night out with the guys, being met by your wife …

Member Avatar for mayo_tech11
0
94

The End.