447 Posted Topics

Member Avatar for ART01

Maybe something like:[code=cpp]nodo *p1, *p2; p1 = List; p2 = List->next; if ( p1->key == p2->key ) // or p1->key == p1->next->key // do this...[/code]Your problem is that you don't have a random access element for your list, i.e. the [] operator. You could probably write that if you wanted.

Member Avatar for sidatra79
0
109
Member Avatar for mzdiva041986

I think what you're looking for is [URL="http://www.cplusplus.com/reference/stl/set/erase.html"]erase[/URL].

Member Avatar for twomers
0
109
Member Avatar for justinlake888

A loop's a loop. It doesn't matter how you do it. It's entirely equivalent. No matter which you choose all should produce the same five-time iteration that you want. I'd use [inlinecode]for[/inlinecode] but a [inlinecode]while[/inlinecode] would work too.

Member Avatar for Sci@phy
0
99
Member Avatar for zeroth

Fingers. If you want to vote for someone you cut off your finger and put it in a box. Most fingers wins. It'll mean only people who REALLY want a candidate will vote so you get the best government.

Member Avatar for Dave Sinkula
1
185
Member Avatar for geemicah

One problem. [inlinecode]scanf("%d",&kilowatt);[/inlinecode] kilowatt isn't an integer. Change the format specifier to what you'd use for a float. Is this right? [inlinecode](kilowatt-15)*20+(10)+compute_tax(total);[/inlinecode] Haven't looked at it, just seems odd that you're taking 15 from kW. Is this right? [inlinecode]totalwtax=total+tax;[/inlinecode] Should it be * not +?

Member Avatar for geemicah
0
98
Member Avatar for cwilliam912
Re: C++

For dynamic arrays first forget anything about uppercasing for the moment and read about the [URL="http://www.cplusplus.com/doc/tutorial/dynamic.html"]new and delete[/URL] keywords. This is how C++ dynamically allocates memory. So after you're familiar with this read an (unsigned) integer via [inlinecode]cin[/inlinecode]. Use [inlinecode]new[/inlinecode] to allocate the array of the size the integer specifies. …

Member Avatar for twomers
0
245
Member Avatar for christina>you

>> Quite possibly, it is simply another form of matter.. An anti-matter I don't think so. I remember being fascinated about what my physics teacher (don't judge him because of the gravity definition he gave us, media player thread), said about what would happen if matter man and an anti-matter …

Member Avatar for GrimJack
0
2K
Member Avatar for califguy

I did something similar to this before and I found the best way to do it was to create a packet structure... something like:[code=C]struct packet_structure { char preamble; char length; char from; char to; // ... etc };[/code]I found it a lot more accessable that way. Do you have to …

Member Avatar for rpiper138
0
113
Member Avatar for botter911
Member Avatar for AutoC

In my opinion without some careful management it's asking for trouble. Why do you have to open it? Couldn't you do something like...[code=c++]std::[i/o]fstream fstr; // ... fstr.open( "file_name" ); do_recurs_function( fstr, /*other params*? ); fstr.close();[/code] I had a similar situation where I was opening and closing streams (to different files …

Member Avatar for AutoC
0
100
Member Avatar for iichi07

Try, at least. Then come back with an attempt and we'll help from there. We'll explain your mistakes, suggest how to fix and then you'll have a working solution.

Member Avatar for iichi07
1
220
Member Avatar for emoaldrin29

This is more of a "Here's my problem. I've tried this but it doesn't work, please help" site rather than a "be my friend and fix my problem site". Explain the problem here and you'll likely get a response.

Member Avatar for twomers
0
78
Member Avatar for kux

To understand the reasoning of this execute the following:[code]int main() { std::cout<< sizeof( unsigned long) << ", " << sizeof( unsigned short ) ; return 0; }[/code]Basically short*short = short, but you're comparing this to a long. So there's a size mismatch. YOu could cast the shorts if you want …

Member Avatar for kux
0
133
Member Avatar for The Dude
Member Avatar for guest7

Heh. In between. Normally people say 'from'. I was going to ask you what system you're using but [URL="http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1044654269&id=1043284392"]this[/URL] solution, I think, covers most of 'em.

Member Avatar for twomers
0
39
Member Avatar for zandiago
Re: Ufo

Obviously not comprehensive (cause of unheard-coverups), but here's a longish list (I like lists): [url]http://en.wikipedia.org/wiki/List_of_UFO_sightings[/url] You're one's mentioned at the end, Josh: [QUOTE]Dozens of residents of Stephenville claim to have seen a "large silent object with bright lights flying low and fast." Several also reported having observed fighter jets chasing …

Member Avatar for R0bb0b
0
486
Member Avatar for DJPlayer

I'd use the modulus operator and the division operator in a loop, something like: [code]do { knum += num%10; } while ( num/=10 );[/code]

Member Avatar for Cepolation
0
161
Member Avatar for Demonisya

So a number is taken from a user, and 2 is subtracted from it until it's 0? Why do you have an array or a[100]? Do you need to save each number? Just try to think about it. Problem:[LIST=1] [*]You're given a number. [*]You take two from [I]this[/I] number, [*]you …

Member Avatar for Demonisya
0
309
Member Avatar for Jennifer84

[code=cpp]#include <iostream> #include <vector> int main( void ) { // 4x5 (4 in x, 5 in y) array, containing -1 std::vector< std::vector<int> > vvint( 5, std::vector<int>( 4, -1 ) ); for( int j=0; j<vvint.size(); j++ ) { for ( int i=0; i<vvint.at(0).size(); i++ ) { std::cout<< vvint[j][i] << " "; …

Member Avatar for twomers
0
738
Member Avatar for Sci@phy

What time do you want it on your desk for? I've never had to do this, but did a quick Google search and got this -- [url]http://support.microsoft.com/kb/243953[/url] Looks about right, works too.

Member Avatar for Duoas
0
409
Member Avatar for aftommy

Does this problem recur every time of just for control panel or security centre? This probably isn't the best place to get answers for your problem, aftommy, maybe try the windows forums -- [url]http://www.daniweb.com/forums/forum99.html[/url] You'll probably find the best help in the correct forum.

Member Avatar for drivezone
0
202
Member Avatar for The Dude

On the contrary - best remake ever - Jimi eat world - Firestarter :) I don't like them normally, but I love that song.

Member Avatar for The Dude
0
173
Member Avatar for maydhyam

I dunno... babies sleep for like 12 hours a day. My nephew's like 1 sleeps from 8PM to 7AM with a nap for an hour or so.

Member Avatar for selfhelpebooks
0
119
Member Avatar for joshmo

In this order (ordered by difficulty of problem to be tackled) -- do nothing out of ordinary, music, tea, coffee, beer, Irish coffee, straight whiskey. Normally do a linear iteration through the set and stop when the relaxing method meets the challenge.

Member Avatar for 0named
0
355
Member Avatar for UrbanKhoja

I like this topic. Wasn't it Einstein who said "You don't understand something fully unless you can explain it to your grandparents"? I'm nearly sure I'm mixing quotes, but I stand by it.

Member Avatar for scru
0
332
Member Avatar for savinki

So it'll say like 13 and you want to grab the next 13 characters? Will the length actually be wrapped in []? If ya have boost installed use boost::regex for the simplest way. You might be able to use strtok to split them all with respect to [, skip till …

Member Avatar for Radical Edward
0
169
Member Avatar for Salem
Member Avatar for majestic0110

I had an amusing one today. I'm writing a SMS sending program. It's a remake of a program I wrote ages ago for the same purpose, but the wobsite to which the program interfaces changed its layout so I had to change my program. Anyhow, cookies are now used by …

Member Avatar for twomers
0
137
Member Avatar for Salem

Alpha and omega. Beginning and end. All I can say is thank Dani for the webpage preview. Saved a lot of time!

Member Avatar for GrimJack
1
121
Member Avatar for Nemoticchigga

Do it via a timer. In the message loop handle the timer event for repainting and repaint.

Member Avatar for Nemoticchigga
0
54
Member Avatar for gogoc
Member Avatar for gogoc
Member Avatar for majestic0110

I'd say 24 season one. The others were a bit too much for one man to handle in one day. But season one was good. Perfect day.

Member Avatar for sneekula
0
262
Member Avatar for etc123

Yeah. I seem to remember a headline along the lines of "State of the union undress", which I chuckled at. Peta.... people eating tasty animals, right?

Member Avatar for jephthah
0
167
Member Avatar for mattyd

What exactly is that meant to establish? Are you seriously trying to start anything other than an argument?

Member Avatar for ~s.o.s~
3
10K
Member Avatar for Kadence

Try using regex in a program and tell us what happens! You'll need a regex library. There should be some freely available. Boost has one, right?

Member Avatar for twomers
0
47
Member Avatar for manzoor

You could always have them in an array and use [URL="http://www.cplusplus.com/reference/algorithm/min_element.html"]min_element[/URL] and max_[URL="http://www.cplusplus.com/reference/algorithm/max_element.html"]element[/URL] From site:[code=cpp]// min_element/max_element #include <iostream> #include <algorithm> using namespace std; // snip int main () { int myints[] = {3,7,2,5,6,4,9}; // using default comparison: cout << "The smallest element is " << *min_element(myints,myints+7) << endl; cout << …

Member Avatar for William Hemsworth
0
103
Member Avatar for Black Magic
Member Avatar for touqra

Alternatively, if you want to return something you could create a struct/class which contains the data you want to return. [code=cpp]#include <iostream> #include <string> #include <fstream> struct names { std::string first_name; std::string last_name; }; names read_from_file( std::ifstream &in ) { names i_names; in >> i_names.first_name >> i_names.last_name; return i_names; }[/code]Probably …

Member Avatar for vijayan121
0
104
Member Avatar for henpecked1
Member Avatar for dougy83
0
128
Member Avatar for DangerDev
Member Avatar for Dannyo329

Depends how you program. If you're programming a GUI, like with win32api or mfc maybe, it's a doddle. There's this for displaying a picture in dos - [url]http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1044665557&id=1043284392[/url] but I don't know if it works.

Member Avatar for Dannyo329
0
89
Member Avatar for The Dude

Apparently a whole pile of [URL="http://www.myheritagefiles.com/K/storage/site1/files/67/23/92/672392_14989604512284fctyzs48.JPG"]chicks[/URL]... odd.

Member Avatar for twomers
-1
293
Member Avatar for The Dude

>> (Havent ever heard of them Dude!? Where have you been. They're those old cynical fellahs. [url]http://en.wikipedia.org/wiki/Statler_and_Waldorf[/url] Animal :) He's that crazy drummer. Oh muppets.

Member Avatar for The Dude
0
109
Member Avatar for nouryn

Why don't you show us what you have started and we'll go from there. If you have nothing started start and you'll be more likely to get help.

Member Avatar for nouryn
0
180
Member Avatar for HugoRocha

Why do you need to cast or even make a and b? Just test num1 and num2:[code=cpp]using namespace std; int main() { while(1) { int num1, num2; cout << "Insert two numbers" << endl; cin >> num1 >> num2; if ( ( num1 <= -1 ) || ( num1 > …

Member Avatar for HugoRocha
0
101
Member Avatar for briansmall
Member Avatar for The Dude

"He is an inspiration for many around the village" I suppose inspiration is all relative.

Member Avatar for twomers
0
117
Member Avatar for zandiago

>> Every generation thinks the up and coming generation is declining in morals. Precisely. And I don't think that it's really a moral issue. This current generation probably has more exposure to everything than any other previous generation -- with the internet, tv, etc. Sure not all of these things …

Member Avatar for jbennet
0
861
Member Avatar for Black Magic

A solution to what you desire is given pretty much straight away, but it makes an interesting read -- [url]http://www.eternallyconfuzzled.com/arts/jsw_art_rand.aspx[/url] It's not, however, a question about srand. That merely 'seeds' rand. You want to get random numbers which is rand.

Member Avatar for CoolGamer48
0
88

The End.