82 Posted Topics

Member Avatar for makimbo

[code]$rands = range(1,40); shuffle($rands); for ($i=0; $i<$numeroDeobjetos; $i++) { $usada[$rands[$i]] = true; }[/code]

Member Avatar for makimbo
0
135
Member Avatar for jimmymack

Line 56. [code]int d = rhs.denominator[/code] This misses an ending semicolon. [i]Line 47:[/i] When adding two variables of the type [b]Rational[/b] like: [code]f1 + f2;[/code] What happens function-call wise is: [code]f1.operator+(f2);[/code] so [b]Rational rhs[/b] is the [b]Rational[/b] that is added to the [b]Rational[/b] with which we start.

Member Avatar for jimmymack
0
119
Member Avatar for jimmymack

Because the [b]\[/b] is the character used to escape things like quotes, it's not appropriate to use it on its own. Use [code]std::cout << " \\ ";[/code] instead.

Member Avatar for jimmymack
0
155
Member Avatar for toferdagofer

[code]bool playAgain = true; cin >> playAgain; while( (playAgain == 'Y' || playAgain == 'y' ));[/code] Enough of a hint? :)

Member Avatar for toferdagofer
0
176
Member Avatar for Derek Elensar

[code]output.open("TEMPS.DAT", ios::in);[/code] [code]output << temp[counter1] << endl;[/code] Do not make sense as you are trying to [b]write[/b] to an [b]in-stream[/b]. This should be what you're looking for: [code]output >> temp[counter1];[/code]

Member Avatar for Derek Elensar
0
177
Member Avatar for ebanbury

You can't include array variables in double-quote strings like that, this has to be done either of two ways: [code]// Connect to the database $dbc = mysqli_connect("localhost", "xxxxxxx", "xxxxxxxxx", "xxxxxxx"); $data = "SELECT ID FROM user_registration WHERE username = '" .$_SESSION['username']. "'"; $query = mysql_query($data) or die("Couldn't execute query. ". …

Member Avatar for ebanbury
0
196
Member Avatar for davy_yg

Yes the line numbering is correct so the question is, why did you put a [b]-->[/b] at the end of line 36? (And also 37, 38, 39) Maybe you were trying to comment out those lines? Note that what you've placed are only HTML comments and since PHP executes before …

Member Avatar for Insensus
0
250
Member Avatar for munitjsr2

If you look at this page [url]http://www.cplusplus.com/reference/algorithm/find/[/url] you'll see that [b]find()[/b] requires the [b]== operator[/b] to be defined on your class, and it's not. Something like this probably: [code]bool A :: operator ==(const A &t) const { return ((x == t.x) && (strcmp(name, t.name) == 0)); }[/code] On a side …

Member Avatar for munitjsr2
0
243
Member Avatar for designalex

The first attempt doesn't work because if it WOULD work, you could never write the word IPADDRESS in a string without having it replaced by it's definition. What might work but of which I'm not sure is using {IPADDRESS} instead of just IPADDRESS. And in the second attempt you didn't …

Member Avatar for designalex
0
187
Member Avatar for DeIntegro

[QUOTE=floatingDivs;1549222]DeIntegro, The reason you're only getting one row is because you're querying for one row. You need to query an array of rows. [code] $row = mysql_fetch_[b]row[/b]($result); [/code] should be [code] $row = mysql_fetch_[b]array[/b]($result); [/code][/QUOTE] This is not true. Both functions fetch one row from the query and store it …

Member Avatar for dos_killer
0
474
Member Avatar for hawita

The easiest way to see if the derivative changes sign when considering time derivatives would of course be to see if the difference between the last and 2nd to last Z changes sign. This would mean something like [b]if((deltaZ[lcv] - deltaZ[lcv - 1]) * (deltaZ[lcv - 1] - deltaZ[lcv - …

Member Avatar for jonsca
0
190
Member Avatar for xiiopao
Member Avatar for IndianaRonaldo

Quote from cpp reference: 'Allocates a block of size bytes of memory, returning a pointer to the beginning of the block. The content of the newly allocated block of memory is not initialized, remaining with indeterminate values.'

Member Avatar for IndianaRonaldo
0
215
Member Avatar for rajeesh_rsn

[QUOTE=makman99;1542345][code]$result = str_replace ("--","-",$string);[/code] Should remove all if there's 3 in a row: --- It would find the first two [--]- and replace with one: [-]- leaving -- which is then replaced by -[/QUOTE] Neither has the desired behaviour. str_replace doesn't rescan already replaced input and so --- will be …

Member Avatar for chrishea
0
183
Member Avatar for McLaren

You've misplaced the parenthesis in this line: [code] if(strcmp($line,$name == 0)) {[/code] Should of course be: [code] if(strcmp($line,$name) == 0) {[/code]

Member Avatar for McLaren
0
115
Member Avatar for Leo_london

Do you mean that this effect has to happen in real time or are you trying to 'render' the images with GD? Because if you're aiming for real time, GD wouldn't be my tool of choice since you'd have to use for instance AJAX to get every next image from …

Member Avatar for tomato.pgn
0
79
Member Avatar for Insensus

Hello there forum, After a pretty thorough C++ course I've tried my hands at coding an actual project but have stumbled on a pretty big problem and here I am asking for your help. What I'm trying to make right now is a class which communicates with a gameserver through …

Member Avatar for Insensus
0
150
Member Avatar for mbarandao

You're missing an ending double-quote here. [code]$servicesoffered="<br/>"."$edit_servicearea_str<br/>\n$detailedmsg<br/>;[/code]

Member Avatar for mbarandao
0
96
Member Avatar for d4n1s
Member Avatar for RazorRamon

[CODE]<option value="cashout">Refinance-Cashout</option>[/CODE] [CODE]$buysell=="Refinance - Cashout"[/CODE] That doesn't match. Should be [CODE]$buysell=="cashout"[/CODE]

Member Avatar for Insensus
0
183
Member Avatar for jnewing

Is reversing the vector an option? I guess this should work: [code]reverse(foo.begin(), foo.end()); long some_long = *(long *)&foo[0];[/code]

Member Avatar for Insensus
0
215
Member Avatar for Gernicha

That's because an array is nothing but a pointer to the start of a memory block, so [code]cout << array << endl;[/code] will print the memory address of the start of your array. To print the whole array you should iterate over the 'rows' (first index) and print each array …

Member Avatar for Gernicha
0
187
Member Avatar for dunderMiflin

[QUOTE]I am a 22 year old college gal[/QUOTE] I see what you did there.. :P This is the short solution I came up with, but I wouldn't know if it's valid for your exercise. [code]#include <iostream> using namespace std; int posInteger(int sum){ int number, revSum = 0; cout << "Enter …

Member Avatar for Insensus
0
235
Member Avatar for luislupe

What rubberman said is actually wrong. In a multiset an element's key is itself so you need to specify only one type. Now I'll try to explain to you why you get this error: When you use a function that's defined from a template, your compiler will at compile-time create …

Member Avatar for mike_2000_17
0
329
Member Avatar for xxreenaxx1

This simply means that the [b]$var[/b] you're trying to split doesn't contain any [b]|[/b] at all, therefore the resulting array ([b]$tmp[/b]) is only 1 element long and [b]$tmp[1][/b] doesn't exist.

Member Avatar for xxreenaxx1
0
111
Member Avatar for globberbob

The [b]dereference (*)[/b] operator has lower priority than the [b]member (.)[/b] operator so you need to add brackets: [code=C++](*str).length()[/code]

Member Avatar for globberbob
0
7K
Member Avatar for dalip_007
Member Avatar for zyberb

[B]strpbrk[/B] effectively returns the part of the string starting at the first occurence until the end of the string. If you pass such a string to [b]atoi[/b] it will return the first numeral and ignore everything after that. Note that this numeral doesn't have to be 1 digit long but …

Member Avatar for Insensus
0
291
Member Avatar for rootseire

If in your while loop you know which one is the one you want to display add 'selected' to the <option> like so: [code=html]<option value="..." selected>[/code] For which you can use the short if-else: [code=php]<option value="..."<?php echo ($selected) ? " selected" : ""; ?>>[/code]

Member Avatar for rootseire
0
187
Member Avatar for xxreenaxx1

Maybe you can post a little more about the structure of your table, maybe some sample data? I can't really visualize what you're trying to accomplish right now.

Member Avatar for Insensus
0
128
Member Avatar for mbarandao

[url]http://php.net/manual/en/function.header.php[/url] This lets you change the HTTP headers which is probably the best way to redirect someone. Something like: [CODE=php]Header("Location: /$directory");[/CODE] Be sure to put it early in your document, before any output is generated, or you will get an error because you can't change the headers anymore.

Member Avatar for mbarandao
0
1K
Member Avatar for stereomatching
Member Avatar for stereomatching
0
109

The End.