Forum: C++ Apr 29th, 2009 |
| Replies: 3 Views: 638 I think it would be more useful if one could pass the string into a method and have it return the number of question-marks found (as an unsigned int, or in extraordinary cases an unsigned long int). |
Forum: C++ Nov 22nd, 2008 |
| Replies: 3 Views: 448 There is hope!
Use fmod to resolve the modulus between two doubles
#include <iostream>
using std::cin;
using std::cout; |
Forum: C++ Nov 20th, 2008 |
| Replies: 2 Views: 305 That means you are literally treating something that isn't an lValue as an lValue.
For example if a method doesn't return a reference to something, its possible that attempting to treat the method... |
Forum: C++ Oct 22nd, 2008 |
| Replies: 7 Views: 509 That's one way of doing it, but you could also use eager-inclusion.
// file.h
#ifndef MYHEADER_H
#define MYHEADER_H
/*Declaractions*/
#include "file.cpp" |
Forum: C++ Sep 16th, 2008 |
| Replies: 17 Views: 1,525 Split the lines up into words and place the words for a corresponding line into a vector.
For example, vector<string> a has elements "I", "believe", "in", "you" and vector<string> b has elements... |
Forum: C++ Sep 16th, 2008 |
| Replies: 17 Views: 1,525 Oddly enough I was working away at a tokenizer. I think that my snippet (http://www.daniweb.com/code/snippet954.html) might be helpful, but maybe not if this is an assignment.
If it is an... |
Forum: C++ Aug 31st, 2008 |
| Replies: 12 Views: 1,711 I'm not exactly sure how your professor wants this done, but...
Personally what I'd do is make a topic for each game of Boggle and implement a dictionary of words then map out specific words to a... |
Forum: C++ Aug 25th, 2008 |
| Replies: 9 Views: 699 You know, I tried to make up for my dumb response earlier by developing a meta-program for this algorithm to see if it would speed it up some.
I spent the last 2.5 hours doing tests on the std... |
Forum: C++ Aug 22nd, 2008 |
| Replies: 8 Views: 1,935 Ok one big thing to note, before anything else--
vector<vector<double>>
-- is not a portable statement because >> may (depending on the compiler) be analyzed as the right bitshifting... |
Forum: C++ Aug 14th, 2008 |
| Replies: 4 Views: 544 Show us what you've come up with on your own.
We help you, we don't code for you @_@ |
Forum: C++ Jul 23rd, 2008 |
| Replies: 14 Views: 1,007 Here's the code in code-tags.
// caja_paquete_2.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream> |
Forum: C++ Jul 22nd, 2008 |
| Replies: 24 Views: 62,338 Here's a toughy.
Write the Snaker program, using either a JFrame, GraphicsProgram or a JApplet (any GUI of your choice really).
Your snaker object will start off as one circle. That circle... |
Forum: C++ Jul 21st, 2008 |
| Replies: 2 Views: 2,996 Get rid of the paranthesis around set--
bool Sort::test()
{
Sort set;
bool answer = false; |
Forum: C++ Jul 16th, 2008 |
| Replies: 1 Views: 507 It could be that string is defined in namespace std, which you forgot to declare that you are using.
Either that or declare--
using std::string |
Forum: C++ Jun 29th, 2008 |
| Replies: 2 Views: 21,689 I know this is a really sad question to ask, but please tell me... how and when should I ever use extern?
I recall an example that Narue showed me but even if I read through the definition from... |
Forum: C++ Jun 24th, 2008 |
| Replies: 20 Views: 1,331 As for your other question - what do you do with Character &getCharacter() -- I'll explain briefly.
Notice that in your Item class, getCharacter() is marked for protected access--
//previous... |
Forum: C++ Jun 24th, 2008 |
| Replies: 14 Views: 910 Think of how area is calculated.
In order to obtain the area of a rectangle, you only need to know the length and width of the rectangle. The area is--
length * width
--which is the easy... |
Forum: C++ Jun 22nd, 2008 |
| Replies: 31 Views: 3,092 Consider the following code, where I store created Location objects in an array then reference each of them. Notice the new name-parameter I gave them. This will help reduce the amount of code you... |
Forum: C++ Jun 21st, 2008 |
| Replies: 6 Views: 722 It's correct because you've generalized your list. That's one of the primary functions of templates - to make a general case for all valid objects/types.
Instead of only taking ints, it now takes... |
Forum: C++ Jun 21st, 2008 |
| Replies: 8 Views: 1,021 I laughed so hard when I read this...
winner |