Forum: C++ Oct 14th, 2009 |
| Replies: 6 Views: 252 Based on what you needed it would make sense for the C++ app to listen (be the server) and PHP to send the data to the server (client) |
Forum: C++ Oct 14th, 2009 |
| Replies: 6 Views: 252 http://php.net/sockets
For C++ you might want to look around for forums, there's bound to be a link to a good one. If not, just google C++ sockets there is a veritable shit-ton |
Forum: C++ Oct 14th, 2009 |
| Replies: 6 Views: 252 There are a couple of ways to do it that pretty easy. If you're using the socket approach you can just have PHP open a client socket and send data to the C++ app. The other way is just to have C++... |
Forum: C++ Oct 9th, 2009 |
| Replies: 10 Views: 362 I was using num as an example. Forget about num, you're using num for your menu. You want to do it for each of your operations like this
else if (num == 1)
{
int rad = -1;
double pie =... |
Forum: C++ Oct 9th, 2009 |
| Replies: 10 Views: 362 Well here
if (num < 1 || num > 4)
You're already checking if user input input is negative for the menu so just use that logic when you get input for the user's other values, for example
if (base <... |
Forum: C++ Sep 9th, 2009 |
| Replies: 14 Views: 492 You would use the function just like you would inside another function. With the example code afunction isn't defined (there is no prototype.) You could do something like this
void afunction(); //... |
Forum: C++ Aug 24th, 2009 |
| Replies: 13 Views: 385 '"string with"' is invalid, '' are used for chars, "" are for strings.
"\"string with\"" is that string |
Forum: C++ Aug 24th, 2009 |
| Replies: 13 Views: 385 somestring = "this is a \"string with \" quotes"; |
Forum: C++ Jun 22nd, 2009 |
| Replies: 17 Views: 1,398 Well it'd be enter operation, enter first number, enter second number -> switch(operation) { calculate answer } -> output answer -> done
EDIT: This is my 1000th post, wooo! |
Forum: C++ Jun 22nd, 2009 |
| Replies: 17 Views: 1,398 Ok, then yeah, follow the instructions. And you only have to worry about dividing BY zero, it doesn't matter if numerator is zero, only check the denominator (secondNum in this case) |
Forum: C++ Jun 22nd, 2009 |
| Replies: 17 Views: 1,398 why would you have to swap for subtraction? Also, you're not checking to make sure that you're not dividing by zero in your division section |
Forum: C++ Jun 22nd, 2009 |
| Replies: 17 Views: 1,398 As a side note, do you notice that you have a lot of repetitive code? That usually means it can be taken out and put in one place. Everything inside the if/else blocks does exactly the same thing... |
Forum: C++ Jun 22nd, 2009 |
| Replies: 17 Views: 1,398 Ya can't just put braces in random spots and expect it to work :)
//Ch6AppE08.cpp
//Displays the answer to arithmetic problems
//Created/revised by Greg Schader on 6/22/2009
#include... |
Forum: C++ Jun 22nd, 2009 |
| Replies: 17 Views: 1,398 When you fix something don't just say it didn't work and wait for another answer, post the updated code |
Forum: C++ Jun 22nd, 2009 |
| Replies: 17 Views: 1,398 Don't forget the braces around your inner if and else statements, take a look in your book on why to do this (if it explains it) |
Forum: C++ Jun 22nd, 2009 |
| Replies: 5 Views: 280 ECMA-48 SGR sequences are used for (somewhat) portable termal color. http://en.wikipedia.org/wiki/ANSI_escape_code#graphics |
Forum: C++ May 8th, 2009 |
| Replies: 24 Views: 1,339 With the math.h(or cmath someone correct me on this) header you can use the floor and ceil functions if I remember correctly to round down and round up respectively. |
Forum: C++ May 5th, 2009 |
| Replies: 8 Views: 311 Yeah, that's a bit easier to follow than what I said but essentially the same :) |
Forum: C++ May 5th, 2009 |
| Replies: 8 Views: 311 It's to solve the diamond inheritance problem where you have a base class, then 2 child classes then a 4th class that inherits from both of the previous classes. If the base class declares a function... |
Forum: C++ Apr 28th, 2009 |
| Replies: 11 Views: 513 That looks suspiciously like a homework question. Perhaps you should give a shot at coding it a bit yourself before we give you a hand. |
Forum: C++ Mar 16th, 2009 |
| Replies: 4 Views: 549 Do you understand what these lines do?
*(boardSkin +(row * columns) + column)
You're setting a memory address to a value, that above line is the same thing as saying... |
Forum: C++ Mar 9th, 2009 |
| Replies: 4 Views: 701 C++ does not have anonymous functions. However, C++0x standard does using the following syntax (using a std::for_each as an example)
std::map<int, int> someMap;
// ... ...... |
Forum: C++ Feb 3rd, 2009 |
| Replies: 3 Views: 247 It's also not doubling in the variable, you're just outputing the variable twice. You have a cout inside the if, and a cout before the return. |
Forum: C++ Dec 27th, 2007 |
| Replies: 30 Views: 2,947 Nope, people that use void main are doomed to be forsaken by the appropriate deity, if the case arises that they do not believe in one then they will be forced to watch nothing but reruns of Who's... |
Forum: C++ Dec 27th, 2007 |
| Replies: 30 Views: 2,947 He was referring to Salem's avatar which states that void main'ers are doomed. void main(), main should always return an int ie., int main() |
Forum: C++ Dec 21st, 2007 |
| Replies: 18 Views: 3,836 int main1() should be int main() but as the poster above me stated that particular include file is not necessary. Also, #include "iostream" should be #include <iostream> Quotes are generally used to... |
Forum: C++ Oct 29th, 2007 |
| Replies: 2 Views: 638 Well, for one you are obfuscating your code to an extreme extent by not giving meaningful variable names. friend zz operator-(zz z);
Secondly, the - operator is a binary operator. It accepts two... |
Forum: C++ Sep 18th, 2007 |
| Replies: 5 Views: 1,004 I guess it's better than "Please help this was due yesterday!" |
Forum: C++ Sep 18th, 2007 |
| Replies: 5 Views: 1,004 In the constructor you are trying to initialize the Day, Month and Year variables to variables which do not exist. In that scope theday, themonth and theyear are not accessible. To fix that you would... |
Forum: C++ Sep 17th, 2007 |
| Replies: 4 Views: 1,058 If you look at line 137 it calles the MessageBox function which takes the arguments
MessageBox(<message to show>, <title>, <buttons to show>, <icon to show>) |
Forum: C++ Aug 4th, 2007 |
| Replies: 2 Views: 1,348 Coding sockets aren't just a one-post length thing. Go download SocketMUD which is a C/C++ barebones MUD codebase. It has pretty much nothing but the sockets so you could see how they work that way.... |
Forum: C++ Aug 2nd, 2007 |
| Replies: 67 Views: 6,153 That line keeps overwriting the values. In the end it is left with only the last values |
Forum: C++ Jul 5th, 2007 |
| Replies: 67 Views: 6,153 You forgot brackets for the while loop so it's only doing the first if-check
while(condition)
{
//do this stuff
} |
Forum: C++ Jun 21st, 2007 |
| Replies: 19 Views: 2,448 Well, you put the if statement in there but you didn't really do anything. Look up if-check syntax in your book it should be:
if (var relation value)
{
statement;
}
Example:
if... |
Forum: C++ Jun 21st, 2007 |
| Replies: 19 Views: 2,448 Yes it does but you are trying to do the calculations before you have gotten any input. It is trying to do the math on a number that doesn't exist. |
Forum: C++ Jun 21st, 2007 |
| Replies: 19 Views: 2,448 Well firstly you are trying to do math with x before it actually has a variable so once it gets the others (a, b, c, d, e, sun) aren't actually giving the correct number |
Forum: C++ Jun 20th, 2007 |
| Replies: 19 Views: 2,448 You are trying to output the value of x before actually getting the value. IE. You are using cout<<x<< endl; before cin>> x; |