6,741 Posted Topics

Member Avatar for zuki

Show us what you've tried. Clearly you know how to open a file and read words from it (more or less), so what's wrong with declaring an array of strings and filling it up with the words from a file? [code=c] char keywords[100][100]; FILE *in = fopen ( "keywords", "r" …

Member Avatar for timnfxr
0
102
Member Avatar for Red Horse

>What would be a good book for C++ starters? In order of usefulness as you learn C++: [B]Accelerated C++[/B] by Koenig and Moo will get you started (beginner). [B]The C++ Programming Language[/B] by Stroustrup will keep you going for quite a while (intermediate). [B]The C++ standard[/B] will blow you away …

Member Avatar for invisal
0
96
Member Avatar for rajatC

>is there any showFile() type of function in libraries?? No, you have to write it yourself.

Member Avatar for rajatC
0
169
Member Avatar for kaly45

>Thanks For what? It looks like you posted your assignment in the hope that someone will do it all for you. Why don't you try it yourself and when you have some proof of effort and a real question, we'll help you.

Member Avatar for ithelp
0
114
Member Avatar for deicer

Subtract myvector.begin() from endpoint and you'll know the size of the vector after calling unique.

Member Avatar for tehprince
0
111
Member Avatar for phalaris_trip

>This seems like a bad idea.. Yea, that's a really bad idea. >So should I redesign the class? No, this is a common problem and there's a common solution. Make the destructor pure virtual, but you still have to give it a body unless you want all of the child …

Member Avatar for phalaris_trip
0
99
Member Avatar for Ancient Dragon

>Any other suggestions ? Can you send me a list of them? I collect programming books, so I may buy some of them off of you.

Member Avatar for Narue
0
105
Member Avatar for guitarrick

Remove all of the parameters. It looks like you're actually expecting the global variables to be the ones that are changed, but when you use function parameters with the same name, they hide the global variables. When the function returns, you haven't changed the global variables at all.

Member Avatar for guitarrick
0
199
Member Avatar for emilio

When working with linked data structures, the best thing you can do is take out a piece of paper and draw the logic. Don't draw what you think is happening, draw exactly what your code does, and you'll find the bugs.

Member Avatar for emilio
0
107
Member Avatar for nemoo

>#include<stdlib.h> To be strictly correct, this should be <cstdlib>. >void main(){ main returns int. >i don't know how to make the number be between 0 and 100 only [ICODE]rand() % 100[/ICODE] is the easiest way, and it should suffice for basic pseudorandom numbers. >the computer always choose the same random …

Member Avatar for rajatC
0
244
Member Avatar for zeropulse

At this point you're not working with multiple bytes, so the only way to split up the value is to shift away the least significant digit.

Member Avatar for Duoas
0
97
Member Avatar for tootypegs
Member Avatar for richasr1

>What i want to do is delete all the shapes in >the group box where the result was wrong. Maintain a list of pointers to shape objects that are added to the group box. Then when you want to delete all of the shapes in the group box, it's as …

Member Avatar for richasr1
0
108
Member Avatar for dv1r

>What is outtextxy? It's a function from BGI's graphics.h library that writes a string to the screen at specific x,y coordinates. >how do i do outtextxy to a int?? You have to convert the int to a string first. Search the forum, there are plenty of threads on that particular …

Member Avatar for Narue
0
177
Member Avatar for Hawesch

>I'm looking to beable to add the date and time in secs Seconds from when? You'd be better off formatting the date and time, then using that string rather than trying to get some non-portable numeric formatting: [code=c] #include <stdio.h> #include <time.h> int main ( void ) { char buffer[1024]; …

Member Avatar for Narue
0
91
Member Avatar for Acidburn

>is there a way to convert a char[2] = '1', '2' kinda thing to an int ? Yes. It's easiest to store the characters as a string first though, so that you can take advantage of standard solutions without resorting to something manual. A good solution is using strtol to …

Member Avatar for Narue
0
119
Member Avatar for dh273

>DayOff = (Days) x; This is a C-style type cast. It's taking the value of x and attempting to coerce it into the Days type. You should avoid casting whenever possible, because types aren't always interchangeable, and especially in this case you can get in over your head very quickly. …

Member Avatar for Narue
0
103
Member Avatar for bis student

Passing by value is better described as pass by copy. A copy of the value is made and sent to a function. This means that if you change the value in the function, the original remains the same: [code=cplusplus] #include <iostream> void foo ( int copy ) { std::cout<<"In foo …

Member Avatar for twomers
0
128
Member Avatar for zoner7

>Points PointA(); That's not an object declaration, it's parsed as a function declaration (a function called PointA that takes no arguments and returns a Point object by value). Remove the parens: [code=cplusplus] Points PointA; [/code]

Member Avatar for rajatC
0
118
Member Avatar for Cyb3rAssasin

Sleep from windows.h also takes milliseconds, not seconds. Your call would change to [ICODE]Sleep(5000)[/ICODE].

Member Avatar for Duoas
0
92
Member Avatar for np2100

The easiest solution is to use redirection straight from the command string: [code=cplusplus] std::system ( "dir > test.txt" ); [/code]

Member Avatar for np2100
0
78
Member Avatar for Acidburn

puts is used for printing strings, not integers. Change [ICODE]puts( j[i]);[/ICODE] to [ICODE]printf("%d\n", j[i]);[/ICODE] and it should work better.

Member Avatar for Narue
0
76
Member Avatar for obscured47

>I want to throw the exception, the user will see the msg, press return and then terminate. Set your own custom termination handler. Look in your reference for the <exception> header to get more details.

Member Avatar for obscured47
0
155
Member Avatar for kavithakesav
Member Avatar for jntuceh
Member Avatar for Karkaroff

Try flushing the stream after the file is printed. cout isn't tied to your file stream, so a read isn't going to force a flush, and I'm willing to bet that the file isn't large enough to fill the stream buffer: [code=cplusplus] temp.close(); cout.flush(); getch(); [/code]

Member Avatar for Karkaroff
0
310
Member Avatar for Srynx

>You should not ever call main( ) from within you program, >that essentially restarts a new instance of the program! No, it essentially doesn't compile. C++ doesn't allow recursive calls to main.

Member Avatar for CPLUSCPLUS
0
672
Member Avatar for thetechguy

>Wow 0.o huge right Eh, I've seen worse. >What language are you using? Well, C++ [i]does[/i] support those alternative tokens. C does as well if you include <iso646.h>. >Oh my god! Why not initialize this way: >char board[ROWS][COLUMNS] = {'.'}; Probably because that wouldn't work. It only initializes the first …

Member Avatar for thetechguy
0
734
Member Avatar for Cyb3rAssasin

Use a string instead: [code=cplusplus] #include <iostream> #include <string> using namespace std; int main() { string op; cout << "enter test "; cin >> op; if(op == "test") cout << "test sucessful\n"; else cout << "w00t\n"; } [/code]

Member Avatar for Cyb3rAssasin
0
64
Member Avatar for Max_Payne

>Can i initialize char arrays using preamble initialization ? That's the first time I've heard that term, but I'll assume you're asking if you can use strcpy_s in the way you've attempted. Since you received an error, I'm wondering why you're even asking the question because it's obviously not allowed. …

Member Avatar for Narue
0
274
Member Avatar for ndeniche

>Should I understand that he is an admin/staff writer? Davey is happygeek, the second admin aside from Dani.

Member Avatar for Serunson
0
155
Member Avatar for emilio

>can anyone tell me why ? swapNode doesn't do anything. When you want to change a value, you pass a pointer to that value, right? [code=c] /* Changing the original objects that a and b point to */ void swap ( int *a, int *b ) { int save = …

Member Avatar for emilio
0
96
Member Avatar for Karkaroff
Member Avatar for Narue
0
79
Member Avatar for Jishnu
Member Avatar for Jishnu
0
274
Member Avatar for Thunder_1024

The message is pretty clear about what's wrong. You say that insertNumber returns an integer value, but you fail to return a value with a return statement: [code=java] return 0; // Or some other number [/code]

Member Avatar for Thunder_1024
0
252
Member Avatar for guy40az

>My question is do I have to add all the include files to the command line? You don't add headers (include files) on the command line. They're strictly for the compiler so that it has declarations for the names that will be linked in later. What you're doing is telling …

Member Avatar for Salem
0
176
Member Avatar for Karkaroff

>If you have any difficulty in understanding(at a quick glance that is!) Most of your comments are pointless. At a glance I can tell what the code is doing; any reasonably experienced programmer can do this easily. What I really want to know is [I]why[/I] you're doing it. I can't …

Member Avatar for Karkaroff
0
248
Member Avatar for Jishnu

>Something should really be done about that, as I'm sure if that were >an actual post, a warning would be issued from Admin at the very least. Good idea. Reputation comments do fall under Daniweb's policies, so anyone who feels a comment was out of line can report it, and …

Member Avatar for invisal
2
193
Member Avatar for bobei89

>warning C4013: 'strlen' undefined; assuming extern returning int Make sure to add [ICODE]#include <string.h>[/ICODE] to your code.

Member Avatar for bobei89
0
680
Member Avatar for bis student

>what does it this mean Initialize the array so that the first 25 >components are equal to the square of the index variable ? I would assume something like this: [code=cplusplus] for ( int i = 0; i < 25; i++ ) alpha[i] = i * i; [/code]

Member Avatar for invisal
0
4K
Member Avatar for The Dude

>Have you ever cheated on a test/exam? Yes, but I was considerably better at it than you seem to be. ;)

Member Avatar for invisal
0
363
Member Avatar for zoner7

>It looks like he's declaring variables, but there is no type. He is declaring a variable, and the type of the variable is [ICODE]enum Days[/ICODE]. DayOff is an instance of the Days enumeration. >In line 11, what does days(x) mean? As an example, Days(1) is the same thing as Monday. …

Member Avatar for Lerner
0
89
Member Avatar for zeroground

>can u tell me how to change the color of the background and text ? There's no standard way to do it, but because you seem to be using a Windows compiler, I'd say [url=http://msdn2.microsoft.com/en-us/library/ms686047.aspx]this[/url] is your best bet. >#include<stdio> Remove this, you're not using anything from stdio. Also, it's …

Member Avatar for invisal
0
182
Member Avatar for abu moh

I personally have a problem with downloading mysterious attachments. It would be more considerate of you to post a bare bones example of your program that exhibits the problem you want help with.

Member Avatar for Ancient Dragon
0
68
Member Avatar for drkprgrmer

apvector isn't supported directly by Visual Studio. Do you have the actual header, or are you getting an error that it can't be opened (because it doesn't exist)?

Member Avatar for drkprgrmer
0
102
Member Avatar for prasath

>Can any one explain what exactly happens when there >is a buffer over flow and how does it affect malloc. No, because that's an implementation detail. It depends on how malloc works for your system as well as what you're doing in your code. Post your code that fails (preferably …

Member Avatar for dubeyprateek
0
3K
Member Avatar for jobs

>However, I am sure you can complicate this question up to a great extent. Yea, like "oh wait, I'm not using Windows!". ;)

Member Avatar for Salem
0
241
Member Avatar for kakilang

>You are talking GUI programming No, PlaySound isn't a GUI function, but it does require linking with a new library. >can anyone help to show the problem You need to link with winmm.lib. IIRC you can go to the Project menu, select Project Options, then in the box titled "Object …

Member Avatar for Salem
0
1K
Member Avatar for anumalayil

>can anyone help in developing a code 4 msking a telephone directory using class? Can you be any more specific? >is der ny1 2 help me?hw can i c th rply 4 ma questns? Not if you keep typing like your keyboard is broken. Full sentence English with an attempt …

Member Avatar for Narue
0
100
Member Avatar for zeroground

>Please use some code indenting to make it more readable. For example: [code=cplusplus] #include <iostream> #include <conio.h> using namespace std; int main() { int x, y; while ( true ) { cout<<"Please Enter a positive number\n"; cin>> x; if ( 0 != x || 1 != x ) break; cout<<"Please …

Member Avatar for Narue
0
68

The End.