15,300 Posted Topics

Member Avatar for ticktoc09

Use fgets() if you want to put spaces in the text. The side affect of fgets() is that it puts '\n' at the end of the string, if it will fit. [icode] printf("Dog's name?:"); fgets(str2, sizeof(str2), stdin); // now remove the '\n' from the string if( str2[strlen(str2)-1] == '\n') str2[strlen(str2)-1] …

Member Avatar for navedalam
0
118
Member Avatar for valkyrie

Your link appears to be broken -- I get an IE error that the page can not be displayed.

Member Avatar for template<>
0
203
Member Avatar for SolidSora

what is the error??? Please don't make us guess. You don't need a loop just to get the first letter of the string, so you can just delete lines 17, 18 and 29. [icode]cout<<lastName <<", " <<firstName<<" " <<middleName[0] <<endl;[/icode]

Member Avatar for template<>
0
117
Member Avatar for scarlettmoon

1. you don't need that while loop that starts on line 5 so just delete it2. 2. The for loop sould cout from 0 to < size, not <= size-1. If the value of size is 5, then you want it to count 0, 1, 2, 3 and 4. 3. …

Member Avatar for scarlettmoon
0
366
Member Avatar for gyuunyuu

The structure is declared incorrectly -- wrd needs to be a pointer so that it can be allocated at runtime. [icode] struct word { int count; // counter to use the word's occurrence char* wrd; }*wordptr[50]; [/icode] line 21: >>wordptr[position] = (struct word *) malloc(sizeof(struct word)); You need to do …

Member Avatar for gyuunyuu
0
172
Member Avatar for Progr4mmer

Those pictures are called avatars, and are available to anyone. Set yours in the CONTROL PANEL link found at the top of each DaniWeb page. Everyone also have titles, but certain members can create their own title (admins, past and current mods, and those who donate their money to DaniWeb, …

Member Avatar for Progr4mmer
1
189
Member Avatar for VernonDozier

>> if(foo()) But Hello World should be displayed regardless of the return value of foo(), and the || 1 causes that. So you can't just toss out that or condition.

Member Avatar for Ancient Dragon
0
176
Member Avatar for thecoolman5
Member Avatar for thecoolman5
0
434
Member Avatar for sajidtariq

You mean how to convert column A to column 1? Yes, that can be easily done. The quickest way would be to take the single-letter column value and subtract 'A'. So if the column name is 'C', then it would be 'C' - 'A' + 1, which is 67 - …

Member Avatar for Ancient Dragon
0
179
Member Avatar for bkoper16

line 15 of report.cpp: That line doesn't do what you want it to do. sizeof(any pointer) is always the same. Arrays are always passed to functions by pointer even if you declare it like an array. Since this is a c++ program you should use vector<int> sales, then that function …

Member Avatar for jonsca
0
776
Member Avatar for wijithapaw

If you do not have the *.lib that normally comes along with dlls then you can use LoadLibrary() to load the dll into memory, then GetProcAddress() to get a pointer to a function in the dll. See [URL="http://msdn.microsoft.com/en-us/library/ms684175(VS.85).aspx"]this[/URL] for details.

Member Avatar for sgollapu
0
1K
Member Avatar for Utsav Chokshi

>>Sorry, you are all wrong. You may have as many mains as you want, provided they are all static (except one, of course). Nope. The only way to do that is to put each of the static functions in different *.c files and not in the same *.c file as …

Member Avatar for nezachem
0
244
Member Avatar for Zjarek

On PCs there was a speed difference some 30 years ago, but hardware technology has advanced to where there is no longer a speed difference. [URL="http://stackoverflow.com/questions/417568/float-vs-double-performance"]Here[/URL] is just one of many threads you can find on the subject. It is my impression that FORTRAN may be a better language to …

Member Avatar for mike_2000_17
0
208
Member Avatar for maikens

With VC++ 2010 look in <cctype> and you will find that it's in std namespace, just as Narue said it is. _STD_BEGIN is defined as [icode] #define _STD_BEGIN namespace std {[/icode] in yvals.h

Member Avatar for pseudorandom21
0
236
Member Avatar for fg_aa_c

You may have to do a lot of recoding. [URL="http://gauss.ececs.uc.edu/Users/Franco/ForksThreads/forks.html"]Read this thread[/URL].

Member Avatar for Ancient Dragon
0
110
Member Avatar for Alice1990

while statements are incorrect. [code] while( InBoundData>>type ) { InBoundData>>speed>>source>>destination>> distance>>depart>>reach>>hour>>ticketprice; cout<<type<<" "<<speed<<" "<<setw(9)<<source<<" "<<setw(3) <<destination<<" "<<setw(5)<<distance<<" "<<setw(5)<<depart<<" "<<setw(2) <<reach<<" "<<setw(8)<<hour<<" "<<setw(10)<<ticketprice<<endl; } [/code]

Member Avatar for Ancient Dragon
0
185
Member Avatar for plang007

line 140: The value of Area is undefined because it has not been initialized to anything. I expect what you meant to say is Area = paint_area / COVERAGE.

Member Avatar for Ezzaral
0
242
Member Avatar for Protoroll

move all those global variables on line 5 down below line 8 so that they are inside the function. Globals are bad -- avoid them when ever possible.

Member Avatar for Ancient Dragon
0
125
Member Avatar for sonuja

Accessing databases can be quite complicated. There are a lot of tutorials about ODBC, the oldest and most widely used way to do it. [URL="http://www.google.com/search?source=ig&hl=en&rlz=1G1GGLQ_ENUS397&q=odbc+c+tutorials&aq=f&aqi=&aql=&oq="]Here[/URL] are a few tutorials for you to study. There are several other ways to do it, depending on the database and operating system, but ODBC …

Member Avatar for Ancient Dragon
0
131
Member Avatar for reemhatim

If you want to convert it yourself then amnt=money[i]*10+1; is incorrect. Should be something like below -- you can not assume the string contains all numeric digits. [icode] while( isdigit(money[i]) ) { amnt = (amt*10) + money[i] - '0'; ++i; } [/icode] Now do something similar for the cents. You …

Member Avatar for Ancient Dragon
0
389
Member Avatar for Hesham Moustafa

what's that [b]demand[/b] stuff??? You start demanding something of us and you will just get ignored.

Member Avatar for Hesham Moustafa
-1
75
Member Avatar for DKDeath

There are at least three ways to launch a process -- system(), ShellExecute() and CreteProcess(). Which one you want to use depends on how much control you want over the newly created process. google for those functions and you will see how to use them. CreateProcess() is the most complicated, …

Member Avatar for DKDeath
0
897
Member Avatar for determine

[QUOTE=determine]new the beginning a meant to say "#include iostream" and "#include cmath"[/QUOTE] No -- the way he has it is correct. The name of standard c++ header files go in angle brackets as shown in the code he posted.

Member Avatar for user422
0
148
Member Avatar for Najeeb gb

Do you mean the functions in time.h or ctime? Read [URL="http://www.google.com/search?source=ig&hl=en&rlz=1G1GGLQ_ENUS397&q=c+time+tutorial&aq=f&aqi=g1&aql=&oq="]these links[/URL]

Member Avatar for Ancient Dragon
-2
34
Member Avatar for tomtetlaw

My guess is the problem is in CTokenStream, but could be wrong. The problem could also be somewhere before that function is called, such as buffer overruns.

Member Avatar for Ancient Dragon
0
114
Member Avatar for coolbeanbob

you can not put function calls in class declaration unless they are inside inline code. Move that srand() line to main() [code] int main() { srand(time(0)); } [/code] Depending on the compiler you are using you may have to typecase time() to unsigned int instead of time_t.

Member Avatar for sfuo
0
4K
Member Avatar for zack654

Too bad that tutorial doesn't have an index to make it easier to find something. It's huge and very tedious to search all of it just to find something.

Member Avatar for zack654
0
137
Member Avatar for jshoot
Member Avatar for shinsengumi

Your program should run ok on 64-bit computers even without recompiling it. The only reason I can think of to recompile that program is to take advantage of the additional memory that 64-bit machines can give it.

Member Avatar for Ancient Dragon
0
608
Member Avatar for prahesh

First check your computer to see if winsock2.h actually exists. If it does, then you probably need to make a change to the list of folders that the compiler uses. You will find that list in Tools or Options menu item. I don't have that compiler installed any more but …

Member Avatar for Ancient Dragon
0
1K
Member Avatar for lexusdominus

[URL="http://www.programmersheaven.com/mb/mfc_coding/189694/189694/how-to-redirect-console-output-into-mfc-text-box/"]Here [/URL]are a couple suggestions that may or may not work for you.

Member Avatar for Ancient Dragon
0
160
Member Avatar for Jutch

What kind of program are you supposed to write? Windows Forms? MFC? wxWindows? win32 api? I assume by now you have been given enough instructions in class to complete this assignment. Or have you been sleeping in class?

Member Avatar for Ancient Dragon
0
427
Member Avatar for gregarion

line 18 in Test.h does not declare an array, but only an uninitialized pointer to an array. Therefore line 30 in Array.cpp will crash because the array has no size. Instead of trying to use an array of std::strings, use a std::vector, e.g. [icode]std::vector<std::string> a;[/icode] Then call vector's push_back() method …

Member Avatar for Ancient Dragon
0
152
Member Avatar for jephthah

Good notion, but it doesn't work. I input "Now is the time for all good men to come to the aid of their country." and all I got back was "untry". I was expecting to get back the first 20 characters of what I had typed, and your function to …

Member Avatar for BNF
1
1K
Member Avatar for spoonlicker

Attached is an example that I whipped up for someone else not too long ago that shows how to have both a console and windows gui app in the same *.exe program. First, create a windows gui app, then a console app. Copy all the source files from the gui …

Member Avatar for peter_budo
0
2K
Member Avatar for progprince
Member Avatar for Prosammer

Do you mean thread ID or window id? All the windows in the same thread of the same thread ID, but each one has its own Window ID (or HWND handle).

Member Avatar for Prosammer
0
912
Member Avatar for efecto

There are probably quite a few articles about drag-and-drop. [URL="http://www.codeproject.com/KB/shell/explorerdragdrop.aspx"]Here [/URL]is one you might find interesting, its a little old now but probably still relivant. It might be a lot easier if you used CLR/C++ or C# and .NET framework. I'm assuming Microsoft has made drag-and-drop programs easier to do …

Member Avatar for Ancient Dragon
0
179
Member Avatar for poloblue

Your compiler is correct -- look at the parameters to SetTime() and then look at the number of parameters main() is trying to pass to it. They ain't the same.

Member Avatar for Narue
0
311
Member Avatar for jsfrocha

Unless your instructor required you to use Dev-C++, you should replace it with Code::Blocks because Dev-C++ has not been updated for quite a few years and contains a very old version of gcc compiler. Code::Blocks is also free and current.

Member Avatar for jsfrocha
0
354
Member Avatar for rjbrjb777

Read the entire file and extract the column(s) you need. I would use fgets() to read a line, then strtok() to split it into individual columns.

Member Avatar for rjbrjb777
0
2K
Member Avatar for peck3277

The PC will have to write the data to the file system because it can't be done from something connected to a serial port.

Member Avatar for Ancient Dragon
0
106
Member Avatar for cyrusmay13

Start with this: [code] #include <iostream> #include <fstream> using std::cin; using std::cout; using std::iostream; using stdLLifstream; int main() { // your program goes here } [/code] Next you will have to create a list of questions and their four possible answers, save them in a text file or just hard …

Member Avatar for eightyseven
0
835
Member Avatar for chamnab

You have to use operating system specific api functions because c++ itself does not support the mouse. On MS-Windows I think you can also use pdcurses library or win32 api console functions. Don't know about *nix, except use curses library for mouse.

Member Avatar for Red Goose
0
139
Member Avatar for deanus

I don't think it really matters to the compiler which place you put the paths, or even if you put the same path in both places. Its just a matter of organization for you. I put project-specific paths in Additional Include Directories, and compiler-specific paths in C++ Directories.

Member Avatar for Ancient Dragon
0
100
Member Avatar for chamnab

Please read [URL="http://www.daniweb.com/forums/thread87719.html"]this thread[/URL]

Member Avatar for Ancient Dragon
0
58
Member Avatar for Manske

The parameters to some functions are incorrect -- you have to pass a pointer to a pointer if you want a function to change the calling function's pointer. Example: [code] struct node* InsertAtEnd(struct node** head, int value) { struct node* newnode = CreteNode(); newnode->data = value; newnode->next = NULL; if( …

Member Avatar for Wafflyn
0
183
Member Avatar for dyingatmidnight

>>I'm using Visual Studio 2008 and referencing a book called "MFC Programming with Visual C++ 6" Get a newer book because MFC changed a lot between VC++ 6.0 and VC++ 2008. The two are not compatible, although you could make it work if you already know MFC well enough. Since …

Member Avatar for Ancient Dragon
0
594
Member Avatar for jake1496

[QUOTE=jwenting;1138145]There is no "best", nor can there be. Not only don't you supply any criteria to use in defining "best" that can be scientifically measured, you don't know all games out there so can't even apply those criteria to every game in existence in order to see how well it …

Member Avatar for davidlouis88
-8
863
Member Avatar for trail453

The loop for the cout statement is backwards [icode]for(i = 9; i >= 0; i--)[/icode]

Member Avatar for trail453
0
132

The End.