15,300 Posted Topics

Member Avatar for XiaO yuEn

>>Can anyone help please? Thx! Sure can. See below [code] int main() { // put your code here } [/code]

Member Avatar for Ancient Dragon
0
70
Member Avatar for lionaneesh

>>The language used in the book is so difficult tat i cud'nt understand tat.. Sounds like you are not yet quite read to study pointers. Yes, pointers can get very very messy and complicated very quickly. My suggestion for you is to stick the the simple pointers -- those with …

Member Avatar for jonsca
0
169
Member Avatar for konata_89

First you have to create another menu item, and then write a function that implements it. Just a simple linear search will do -- from the first to last items in the array.

Member Avatar for Ancient Dragon
0
118
Member Avatar for HBK_100

I don't know what the problem is, but I see two glaring problems. [list=1] [*]scanf("%s", username); -- what happens if someone enters 20 characters as the user name? A: Program will most likely crash because username can only hold 8 characters. Solution: use fgets() instead of scanf() because fgets() will …

Member Avatar for jonsca
0
110
Member Avatar for rjani1

you could just use '\r' to make the cursor return back to the beginning of the line [code] int cookTime(int time) { int second, minute; for (minute = time; minute > -1; minute--) { for (second = 59; second > -1; second--) { sleep(1); printf ("\r%2i : %2i", minute, second); …

Member Avatar for rjani1
0
1K
Member Avatar for D4n1sD
Member Avatar for wilsonz91

you can't use > or < in switch cases -- switch can only be used with constants. In the case you posted the if statements are the best way to handle it. I suppose you could write a switch statement with 100 cases, but that would be dumb.

Member Avatar for abhimanipal
0
148
Member Avatar for Tango2010

How to get all the files in a directory depends on the operating system. In MS-Windows use FindFirstFile() and FindNextFile() found in windows.h. If *nix use OpenDir() and ReadDir(). Then of course you may have to contend with subdirectories. The easiest way to do that is with recursion. Use strcat() …

Member Avatar for Salem
0
209
Member Avatar for roll_in_k

You need to use double pointer there so that foo() can allocate memory for the pointer in main(). You can do the same with as many other pointers as you like, it is not limited to just one pointer. This solves the problem is returning more than one string at …

Member Avatar for roll_in_k
0
350
Member Avatar for sexyzebra19

Are you trying to use a one dimensional array of integers to represent a two dimensional array? If yes, then matrix A would be represented as 1 2 3 4 5 6, and adding matrix B would make it 1 2 3 4 5 6 7 8 9. To find …

Member Avatar for sexyzebra19
0
95
Member Avatar for kotkata

After [icode]cin >> choice;[/icode] you need to flush the keyboard buffer of the '\n' character (Enter key). Just add [icode]cin.ignore();[/icode] after those lines and it should work

Member Avatar for WaltP
0
283
Member Avatar for Stack Overflow

Way too complicated and with unnecessary code. Here is a greatly simplified way to do it. Using strtok() you could parse a string that has more than one kind of deliminator, such as '\n' and '\t' and ',' and the space, these are typical of CVS files (exported XLS files). …

Member Avatar for Ancient Dragon
0
2K
Member Avatar for DJPlayer

you can't realloc() an array what was not a pointer to begin with. you could declare userAnswers as a char***. I've already convered similar situation in another thread here, so I won't repeat it. Just follow the syntax in the other thread how to do it. See my last post …

Member Avatar for DJPlayer
0
187
Member Avatar for ELBUF

you might get better shuffling results if you use std::random_shuffle() found in <algorithm>.

Member Avatar for ELBUF
0
2K
Member Avatar for CppBuilder2006

line 11: you should name that character array something else because [b]string[/b] is declared in the header file <string>. Since you used [icode]using namespace std;[/icode] there is now a name clash between std::string and the string you declared in your WCS class. Your class would be a lot simpler if …

Member Avatar for CppBuilder2006
0
209
Member Avatar for sexyzebra19

The main problem with that class is that the constructor with only one constructor does not initialize the value of both class member variables mdim_ and ndim_.

Member Avatar for sexyzebra19
0
324
Member Avatar for HBK_100

Who the hell wants to read all that crap??? [URL="http://www.daniweb.com/code/snippet217404.html"]Passwords code snippet here[/URL]

Member Avatar for Ancient Dragon
-3
854
Member Avatar for JHus00

If you want to display those variables in main() then you will have to declare them in main() and pass them by value to input() [code] int main() { int temp, windspeed; inpuut( &temp, &windspeed); } void input(int* temp, int* windspeed) { *temp = 30; *windspeed = 20; } [/code]

Member Avatar for Fbody
0
188
Member Avatar for khess

I just installed 64-bit Windows 7 Home Prem the other day. I wanted to upgrade from Vista Home Prem, but the upgrade failed for some reason. So I just did a clean install. I've tried both Ubuntu and Fedora 11, but neither will let me play videos on my DVD …

Member Avatar for moober76
0
3K
Member Avatar for Kombat

Q1: use normal FILE* i/o operations. See functions in stdio.h. You should be able to find tutorials. Q2: see argc and argv arguments to main [icode] int main(int argc, char* argv[])[/icode]

Member Avatar for Ancient Dragon
0
127
Member Avatar for HBK_100
Re: help

>>anyone knows how to use clearscreen with dev [icode]system("cls");[/icode] If you dont' want to use system() then [URL="http://support.microsoft.com/kb/99261"]here is how to do it[/URL] with win32 api functions.

Member Avatar for Ancient Dragon
0
65
Member Avatar for krishh

>>turbo c still is not opening with dos [b]dos[/b] just stands for [b]disk operating system[/b]. Almost all operating systems have a [b]dos[/b], so which one are you talking about? Turbo C will not work with MS-Windows 7, so if that is what you are running either forget turbo c or …

Member Avatar for Salem
-1
86
Member Avatar for cs_stud

>>I'm starting to code the main program but i got a lot of errors when i compiled the code Fix the errors one at a time, recompile after each fix to see what's really left. Compilers like to puke up 10-20 errors for the same line. Post the first two …

Member Avatar for cs_stud
1
618
Member Avatar for jameslat

So let me get this straight. You have no clue about how to write a c or c++ program yet you expect to write something as complicated as that?? put this project aside for awhile until you learn the c++ language.

Member Avatar for jameslat
0
88
Member Avatar for Gonbe

>>This code gives me the following error for the line where the typedef is: windows.h already defines TRUE and FALSE, which are #define's, not typedefs. I suppose you could undefine them before that typedef, but that could cause many other problems with win32 api functions. >>or can I only use …

Member Avatar for Ancient Dragon
0
152
Member Avatar for DHPena

you can use sprintf() to format the string then write() to write that string to the file. line 18: if the file can not be opened the program needs to do two things, not one. [code] if( id < 0) { perror(...); return 1; // abort the program } [/code]

Member Avatar for DHPena
0
441
Member Avatar for webdragon89

>>I've been playing with the code to get the things I need but nothing is working. That's nice -- now post the code you tried because we are not clairvoyant.

Member Avatar for tetron
0
401
Member Avatar for adcodingmaster

A real-life project: Write a computer program that reads data from a serial port that contains UPC product codes from an external scanner device. Use that UPC code as a key to look up product information in an SQL database (such as MS-Access, MS-SQL Server, Oracle, Sybase, etc) then display …

Member Avatar for adcodingmaster
0
209
Member Avatar for igodspeed

line 26: The value of argc will not be less than 1. The first argument to the program is the name of the program itself (on most operating systems). line 27 and 28: What are you trying to do there? cout knows nothing about %d format string. You need to …

Member Avatar for Salem
0
479
Member Avatar for blackrobe

or maybe [icode]rm *.o target*.*[/icode] [edit]:icon_eek: ^^^ That will also delete the source code![/edit]

Member Avatar for Ancient Dragon
0
108
Member Avatar for casjackkwok2001

Do you know how to use the [b]new[/b] operator to allocate an array? If yes, then just allocate an array that is twice the size as the array argument, such as [icode]size * 2[/icode] You will need a function something like this: [code] int* expand(int nums[], int size) { } …

Member Avatar for Lerner
0
2K
Member Avatar for rahul8590

aint array must be allocated with new operator. The way you tried to do it is not yet supported by most c++ compilers. [code] linesize = line.size(); int *aint = new int[linesize]; // The arrays satisfying the condition [/code]

Member Avatar for WaltP
0
201
Member Avatar for ShortYute

What I would do is define a macro for my compiler, then it it's not defined the compiler would be the one your teacher uses. For example if you are using vc++ 2008 then you could use the[URL="http://msdn.microsoft.com/en-us/library/b0084kay.aspx"] predefined macro _MSC_VER[/URL] which is the compiler version [code] #ifdefined (_MSC_VER) #include …

Member Avatar for Salem
0
182
Member Avatar for igodspeed
Member Avatar for futura

Post the code you tried.You could probably use the same character array for all n number of strings because you didn't say there was a requirement to save all those strings.

Member Avatar for futura
0
86
Member Avatar for Marson

A couple ways to do it 1) create a structure that contains the keyword and count of the number of times it appears. Then create an array of those structures, one element for each keyword on the command line. Then read each word of the file, for each word loop …

Member Avatar for WaltP
0
186
Member Avatar for sumitg979

I don't understand what you are asking. That function will sum up however many integers you want to pass to it as long as the last parameter is 0 so that the function knows when to stop. You might want to recode that while loop because the first time through …

Member Avatar for Ancient Dragon
0
2K
Member Avatar for kangarooblood

system() is a c and c++ function. Otherwise you have to use os-specific functions such as the spawn family of functions on *nix, of ShellExecute() and CreateProcess() on MS-Windows.

Member Avatar for Ancient Dragon
0
115
Member Avatar for _siren2

The variable name on line 3 is the same as the function name on line 1 -- bad idea. [URL="http://www.functionx.com/visualc/controls/checkbox.htm"]Read this article[/URL]. Your program has to call one of the checkboxes methods to find out whether it was checked or not.

Member Avatar for Ancient Dragon
0
320
Member Avatar for Sonic42

Step 1: call function time() to get current time in seconds. Step 2: call localtime() to convert the integer returned by Step 1 into a struct tm Step 3: Check if tm_mday is 1

Member Avatar for Nagarajshet
0
87
Member Avatar for clutchkiller

Yup, your program was doing integer division, therefore 2/5 is 0 but 2.0/5 will give you the result you desire.

Member Avatar for clutchkiller
0
109
Member Avatar for infrapt
Member Avatar for NathanOliver
Member Avatar for corby

Looks ok to me -- just remember that srand() is executed only once during the entire lifetime of the program while rand() is executed as many times as you need it.

Member Avatar for corby
0
140
Member Avatar for Nicris

[QUOTE=Fbody;1132718] Your syntax isn't correct, but....[/QUOTE] I don't see anything wrong with the syntax he posted. [icode]int* q = a;[/icode] is perfectly valid as long as a is an array of integers. [edit]Oh, I think you meant [icode]int &p=a;[/icode], which is illegal.

Member Avatar for NathanOliver
0
138
Member Avatar for Excizted

The static_cast<> lets the c++ compiler do a better job of ensuring the cast is valid. For example: this will produce a compiler error (vc++ 2008 express) [code] int main() { int x = 123; char* p = static_cast<char*>(&x); // << ERROR char* p = (char*)&x; // << NO ERROR …

Member Avatar for Excizted
0
142
Member Avatar for alenD

I suppose you could iterate through the map and sum up the length of all the strings and the number of bytes occupied by all those integers. Then there will be a small overhead the map class needs for each of the nodes.

Member Avatar for alenD
0
116
Member Avatar for delhiris

You are not going to find a tutorial that does all that stuff. Learn one thing at a time. google for "ODBC tutorials" and you will find out how to access SQL databases -- you need a good understanding of C or C++ languages. Once you learn that (maybe a …

Member Avatar for Ancient Dragon
0
72
Member Avatar for clutchkiller
Member Avatar for cj_in da house

>>if (*(array i) == *(array i) && &*(array k) != &*(array You must have mis-quoted it because that makes no sense.

Member Avatar for Ancient Dragon
0
26

The End.