2,867 Posted Topics

Member Avatar for grunge man

Tell us what language you're trying to do this in. (ie. C or C++ strings?)

Member Avatar for grunge man
0
267
Member Avatar for countrygirl1970

You're forgetting that C/C++ arrays start at 0, not 1. So you're overrunning the array boundaries when you reference array[9], because that is in fact the 10th element. You might do better to create a 2D array instead of a single dimension, as that is the shape of a Tic-Tac-Toe …

Member Avatar for John A
0
112
Member Avatar for Duki

[COLOR=White]Well done! And btw you should have just made your post invisible... :P [/COLOR]

Member Avatar for jbennet
3
210
Member Avatar for mrjoli021

You're passing a copy of the vector list to fillArray, which goes out of scope as soon as the function returns. Try changing it to a reference: [code=cplusplus] void fillArray(vector<int> &list, int length) { // ...[/code] edit: haha, I beat you Ancient Dragon!

Member Avatar for mrjoli021
0
98
Member Avatar for kendon

Hmm, I'm a little confused being a Canadian, where 'pound' and 'hash' both mean #. And on my keyboard, shift-3 does exactly that. But for the time being, I'm assuming you mean that funny symbol that the British use for their currency (no offense). So if that's the case... I'd …

Member Avatar for jbennet
0
106
Member Avatar for tjay
Member Avatar for ice_tea_lemon

Ever heard of [URL="http://www.cprogramming.com/tutorial/lesson3.html"]loops[/URL] and [URL="http://www.cprogramming.com/tutorial/lesson8.html"]arrays[/URL]? And by the way, using = for comparison is wrong. You must use ==, or you'll end up with a condition that never changes.

Member Avatar for John A
0
149
Member Avatar for Sabi_146

>Heh, I have seen that before...yeah Google Groups... In that case, maybe I should start posting there :mrgreen:

Member Avatar for ~s.o.s~
0
87
Member Avatar for hbk619

Use parameters to pass data between functions. For example: [code=c]void myFunction(int amount); // etc. myFunction(aNumberUserEntered); } void myFunction(int amount) { // 'amount' contains whatever was passed inside the () // blah blah }[/code] A few problems with your code: [LIST] [*]When splitting up your source files, create a .h that …

Member Avatar for hbk619
0
2K
Member Avatar for ericelysia

Sheesh! Why do you make it so complicated? Take a look at the [URL="http://www.asciitable.com/"]ASCII table[/URL]. Each letter has in fact a numeric value. So use this to your advantage. Create an int array of 128 elements, as there are 128 characters in ASCII. Now look how easy it is: [code=c]lookupTable['a']++;[/code] …

Member Avatar for vijayan121
0
138
Member Avatar for dabbakal

>when i delete an item that is not stored the program hangs That's because of this loop here: [code]while ( strcmp(current->name,name) != 0)[/code] If you go beyond the limits of your linked list, you're sending strcmp() a null pointer as one of the arguments. Not a good idea... At this …

Member Avatar for John A
0
935
Member Avatar for grunge man

You'd create an array of words ahead of time. Then when you have input, simply search through the array until you find it. The location where it's found is the number that the word equals.

Member Avatar for grunge man
0
126
Member Avatar for iqbal

Some problems with your code... First of all, what platform are you trying to compile this on? On my Mac, I include [inlinecode]GLUT/glut.h[/inlinecode] (you had included [inlinecode]GL/glut.h[/inlinecode]). Getting the header right removes about 8 errors. You forgot a closing brace here: [code=c] void DrawPixels() { glClearColor(1.0,1.0,1.0,0); glClear(GL_COLOR_BUFFER_BIT); glMatrixMode(GL_PROJECTION); gluOrtho2D (0.0,600.0,0.0,600.0); …

Member Avatar for John A
0
121
Member Avatar for rugae

Input the number as a string, then pop it into a stream and back out to get it back in number form. [code=cplusplus] int number; string line; getline(cin, line); istringstream convert(line); convert >> number;[/code] Check for errors by testing the stream object after conversion. [code=cplusplus] if (convert) // good else …

Member Avatar for John A
0
143
Member Avatar for virus.exe

>Another way of doing it, is using the getchar function. In C. It's not a good idea to use that in C++, use [inlinecode]cin.get()[/inlinecode] instead. Also, you should be aware of the input buffer scenario, and often you'll have to clear it before calling these functions. In C: [code=c] int …

Member Avatar for WaltP
0
2K
Member Avatar for Slavrix

>but am having trouble implementing it. [I]What[/I] are you having trouble with? The more descriptive you are about your problems/questions, the more help you are likely to get.

Member Avatar for Slavrix
0
107
Member Avatar for semmem1

Well, no wonder. You're trying to return the address of a local variable, which will go out of scope as soon as the function returns. (Many compilers including gcc even issue a warning regarding this.) Try putting 'static' in front of the variable, which means that the memory allocated will …

Member Avatar for semmem1
0
94
Member Avatar for mattyd

[quote]He believes graphene is the only viable successor to silicon[/quote] There's always lead; it's a semiconductor. :mrgreen:

Member Avatar for John A
0
53
Member Avatar for grunge man

>ya but wouldnt u have to enter every piece of data individually No. You could use loops to fill in data, which would require very little code. Let me show you an example: [code=cplusplus]for (int i=0 ; i < ARRAY_LENGTH ; ++i) { cout << "Type in a number" << …

Member Avatar for John A
0
153
Member Avatar for IwalkAlone

@FoX_: Read what ~s.o.s~ posted. Using gets() is a bad idea. Here's another link which proves its uselessness: [URL]http://www.cprogramming.com/faq/cgi-bin/smartfaq.cgi?answer=1049157810&id=1043284351[/URL] Your searching function has its flaws, too. I won't say I know better than this, because in the other thread I recommended this solution, trying to save iterations. :rolleyes: If you …

Member Avatar for John A
0
127
Member Avatar for afbach
Member Avatar for Colin Mac

>Yeah, I don't think those work in a C program though. Nope, you have to invoke them with system() calls, which is basically getting the operating system to do the task for you, although it does work... This page uses a somewhat-ugly solution to achieve what you want, although the …

Member Avatar for Colin Mac
0
100
Member Avatar for happygeek

I'm interested... but I have a question: [quote=happygeek;282622]If no member reaches a minimum of 10,000 views or 1000 trackbacks in total, DaniWeb reserves the right not to award any prizes. [/quote] So if this is the total amount of views or trackbacks to our blog (not a specific entry), then …

Member Avatar for blud
1
565
Member Avatar for Duki

It means that it supports the stupid "content protection" thing that's supposed to stop people from pirating content. Hard for the end-user though, and greatly limits choices. (But it's actually good that the monitor supports it, because if it didn't, you would be unable to watch the copy-protected shows at …

Member Avatar for John A
0
53
Member Avatar for blue1984

I don't know Visual Foxpro well enough to give proper recommendation, but I would assume a thread regarding this topic would be somewhere around here: [url]http://www.daniweb.com/techtalkforums/forum16.html[/url]

Member Avatar for John A
0
22
Member Avatar for Narue

I can't really say "favorite" because all the keyboards I've ever worked on were pretty crappy. At the moment I'm using a Logitech mouse (I can't remember which model; it's just a basic optical mouse with a scroll wheel), and an old Apple keyboard from the PowerMac G4 days. :) …

Member Avatar for Serunson
0
1K
Member Avatar for Derice

>How 2 do the same thing without using the strstr function? Write your own. Since a string is really a char array, you're going to need to create some sort of loop. It should:[LIST] [*]Loop for the entire length of the first string (the one that you're searching) [*]Update a …

Member Avatar for John A
0
142
Member Avatar for tronz303

What do you mean exactly? Doe iWeb not look like this when you start it up? [IMG]http://img176.imageshack.us/img176/8453/picture1rj4.png[/IMG] Or are you having problems installing new iWeb templates? I don't quite understand your problem.

Member Avatar for @mac
0
139
Member Avatar for saqib

Maybe you should sort the numbers first before searching them? [edit] Your program seems to work fine as long as the numbers are entered in the correct order: [code]Please Enter The Elements Of Array [COLOR=Blue] 2 5 8 9 12 13 14 17 18 20[/COLOR] Please enter the required number[COLOR=Blue]18[/COLOR] …

Member Avatar for saqib
1
119
Member Avatar for Denisimo

Hello, What you are experiencing seems to be quite common with firewire devices. I've had this problem on multiple different computers, a few of them being Macs, and unfortunately the only solution was to keep plugging and unplugging the camera until a connection is made. There should be a better …

Member Avatar for John A
0
131
Member Avatar for cigar

Or just take a look at this thread... [url]http://www.daniweb.com/techtalkforums/thread50370.html[/url]

Member Avatar for GreenDay2001
0
152
Member Avatar for TheNNS

>What the porst that need to be forwarded for this services? 25, 110 respectively. >I'm also looking for a web based email server for linux. [url]http://www.google.com/search?q=web+based+email+server+for+linux[/url]

Member Avatar for John A
0
89
Member Avatar for mrjoli021
Member Avatar for Manawyddan

So what happens when you try to compile it? There's quite a number of bugs and syntax errors in your code that I can see, so I'd say you've got a lot of debugging ahead of you... For example: [code=cplusplus]cin >> T[i];[/code] What in the world is that supposed to …

Member Avatar for John A
0
123
Member Avatar for Infarction

ESTJ, although a lot of it is just "wannabe" for me, considering how much time I spend at DaniWeb...

Member Avatar for N317V
0
332
Member Avatar for Dark_Omen

You're trying to allocate memory for a static variable. You either do this: [code]Circle *circle = new Circle(radius);[/code] Or you do this: [code]Circle circle(radius);[/code] Remember that when you're using pointers as in the first example, you must delete the memory when you're done with it, and to access members you …

Member Avatar for ~s.o.s~
0
216
Member Avatar for Duki

Wouldn't the formula for calculating the population be: [code]( (population + growthRate) / population ) * population[/code] Because let's say you have 100 people, 100 birthrate, and 50 deathrate. 100-50 = 50, so that's your growth rate. Population + growthRate would be 100 + 50, so 150. Divide that by …

Member Avatar for Duki
0
4K
Member Avatar for hbk619

>i want people to be able to read me![COLOR=seagreen] [/COLOR]Please, green is really hard to read, and coloring entire posts like you are doing is really annoying. If you could refrain from it except for emphasizing a point, that would be great. Thanks. And welcome to DaniWeb, I hope you …

Member Avatar for hbk619
0
667
Member Avatar for ziofu

Hi, and thanks for using code tags. The code itself looks pretty good. I think you should have put more work into validating the user's input. One of the most simple things you could have done is placed a [inlinecode]default[/inlinecode] condition in your input [inlinecode]switch[/inlinecode] block that would inform the …

Member Avatar for ziofu
1
115
Member Avatar for degamer106

>I'm not sure why that is though so I'll just assume its a rule. It's a rule. Protected members are, obviously, protected from the public, and should only be accessible from within the class. Using a hack to get around the limitation destroys the whole purpose of using non-public members.

Member Avatar for John A
0
94
Member Avatar for Duki

>hm, it says str undeclared identifier 'str' is the name of your string. First of all put input into the string perhaps like this: [code=cplusplus] string line; getline(cin, line);[/code] And then use line.length() to find out how many chars the user entered.

Member Avatar for Duki
0
238
Member Avatar for jan1024188

>Now, I d like to know, if I will be able to make a programs using Win32 API in Vista too. My memory's quite foggy, so take what I'm saying with a grain of salt. I think Microsoft had developed a whole new API/system of displaying windows, which was supposed …

Member Avatar for Ancient Dragon
0
121
Member Avatar for gamodg

Check the return value of your read function like it describes at the end of this article: [URL]http://www.gidnetwork.com/b-58.html[/URL] (Basically feof() is the same as file.eof().) [edit] Now I'm confused: are we in C or C++? When I saw you using strstr and char arrays, I assumed we were in C. …

Member Avatar for John A
0
120
Member Avatar for notfornothing21

Google it. [url]http://publib.boulder.ibm.com/infocenter/pdthelp/v1r1/index.jsp?topic=/com.ibm.debugtool6.doc/eqa6rm0380.htm[/url]

Member Avatar for John A
0
126
Member Avatar for maui_mallard
Member Avatar for maui_mallard
0
105
Member Avatar for nuw_gamnera

>so plz help me How about you read this: [URL]http://www.daniweb.com/techtalkforums/faq.php?faq=daniweb_policies#faq_keep_it_organized[/URL] >just send me how i have to make it in details , >with some codings to do that In other words, you want us to do your homework for you. Too bad, you'll have to [URL="http://www.daniweb.com/techtalkforums/announcement8-2.html"]show some effort first[/URL].

Member Avatar for Ancient Dragon
-1
124
Member Avatar for addicted

>LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main You haven't defined your main() function. The linker doesn't know where the entry point of the application is.

Member Avatar for WolfPack
0
199
Member Avatar for sbenware

>[inlinecode]if(strcmp(head->data.name,name) == 0)[/inlinecode] Hm, maybe you want to be comparing the name with the current node instead of 'head' each iteration?

Member Avatar for nottoshabi
0
179
Member Avatar for nottoshabi

>Why? Maybe because the compiler's vendor is the same as the operating system's vendor? Also, Dev-C++ was built more for console applications, so it doesn't have the "goodies" like .NET and high-quality interface builders that speed up GUI development. >And if I have to switch form Dev to Microsoft, is …

Member Avatar for Ancient Dragon
0
115
Member Avatar for addicted

>is the constructor like a form we fill to enter employee details as soon as a new employee is employed? Pretty much, yes. The first and foremost goal of the constructor however, is to allocate memory for the object. Additionally, most constructors provide a way of initializing the data like …

Member Avatar for ~s.o.s~
0
116

The End.