Forum: C++ 34 Days Ago |
| Replies: 3 Views: 255 You mean something like?
#include <iostream>
#include <string>
class Foo
{
public:
std::string sayHello()
{ |
Forum: C++ 34 Days Ago |
| Replies: 1 Views: 398 // strings and c-strings
#include <iostream>
#include <cstring>
#include <string>
#include <vector>
using namespace std;
vector<string> SplitString (string aString)
{ |
Forum: C++ Oct 30th, 2009 |
| Replies: 27 Views: 131,375 If it works, it works.
There's no point worrying about if a better methods exists because getch() or anything that simulates its behaviour is going to be non-standard anyway, so your concern is a... |
Forum: C++ Oct 23rd, 2009 |
| Replies: 9 Views: 556 I thought you purposely gave him a dud answer so he would hand it in. Well done you had me fooled. |
Forum: C++ Oct 13th, 2009 |
| Replies: 3 Views: 296 Next time don't leave your h/w to the last minute. |
Forum: C++ Oct 13th, 2009 |
| Replies: 9 Views: 491 get devshed c++
You don't have to add any compilers. |
Forum: C++ Oct 11th, 2009 |
| Replies: 8 Views: 332 oops i meant
vector<bool>setlist;
setlist.push_back(true);
setlist.push_back(false);
setlist.push_back(true);
setlist.push_back(true); |
Forum: C++ Oct 11th, 2009 |
| Replies: 8 Views: 332 I think your easiest answer would be
vector<int>setlist;
setlist.push_back(3);
setlist.push_back(12);
setlist.push_back(4);
string s1 = ",";
cout << "{"; |
Forum: C++ Oct 11th, 2009 |
| Replies: 8 Views: 332 Well at the end can't you just do an string erase on the last but one element?
string p = "{1,2,3,24,}";
p.erase(p.length()-2,1); |
Forum: C++ Oct 10th, 2009 |
| Replies: 4 Views: 319 There's only one way you're gonna get this to work.
And that is to get your hardware device to spit out the data with a delimiter.
How you do that is irrelevant in terms of c/c++. |
Forum: C++ Oct 10th, 2009 |
| Replies: 3 Views: 282 Never tried it, but the following looks promising...
http://id3lib.sourceforge.net/ |
Forum: C++ Oct 10th, 2009 |
| Replies: 3 Views: 282 If it is an mp3 file I believe this is possible... because they should have mp3 tags. |
Forum: C++ Oct 10th, 2009 |
| Replies: 1 Views: 243 Each character?
I would be inclined to read each line in as a std::string
Then jump through each char in that string. |
Forum: C++ Oct 10th, 2009 |
| Replies: 4 Views: 319 Bingo, without a delimiter you're basically fubar'd |
Forum: C++ Oct 9th, 2009 |
| Replies: 3 Views: 307 I think you should ask your teacher.
Otherwise you could even be wasting your time. |
Forum: C++ Oct 8th, 2009 |
| Replies: 8 Views: 241 Look chicken, the similarities between your little batch programs and real, manly programming languages stop here.
Gotos are essentially an abhorrent unnecessary evil.
They lead to spaghetti... |
Forum: C++ Oct 8th, 2009 |
| Replies: 8 Views: 241 If there was ever a time to use a goto statement. That code just there. In post # 1.
Yep, that would definitely be an essential use of the goto statement.
Wonderful. |
Forum: C++ Oct 8th, 2009 |
| Replies: 3 Views: 206 Why would anyone download a zip file from a relatively unknown user which could contain ANYTHING?
Especially without any real description of what it might be or sample code snippets?
Nope. |
Forum: C++ Oct 8th, 2009 |
| Replies: 1 Views: 204 Seeing as you are using std::strings I would look into using the string replace method.
Also beware of using eof to read files it has a hidden gotcha. |
Forum: C++ Oct 8th, 2009 |
| Replies: 1 Views: 193 http://www.daniweb.com/code/snippet216831.html |
Forum: C++ Oct 8th, 2009 |
| Replies: 3 Views: 307 http://en.wikipedia.org/wiki/Secant_method
If you look at the following web page you can see a sample bit of code which does what you probably need.
However, you say that you want to allow the... |
Forum: C++ Oct 5th, 2009 |
| Replies: 8 Views: 289 Maybe the following may be of some help:
http://www.daniweb.com/code/snippet217091.html |
Forum: C++ Oct 2nd, 2009 |
| Replies: 7 Views: 359 For example....
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
using namespace std; |
Forum: C++ Oct 2nd, 2009 |
| Replies: 7 Views: 359 Yep, and thinking out aloud...
I assume you have to add the third parameter pos which will either be single, start-end or start-middle-end and no other case.
Therefore if you sort your file by... |
Forum: C++ Oct 1st, 2009 |
| Replies: 6 Views: 641 I think you want to sort your struct, not just an array? |
Forum: C++ Oct 1st, 2009 |
| Replies: 7 Views: 359 Hmm, I don't know why you're fixated on using a map.
Why not create your own object/class?
class Something
{
public:
char letter; //a |
Forum: C++ Sep 30th, 2009 |
| Replies: 23 Views: 680 |
Forum: C++ Sep 28th, 2009 |
| Replies: 23 Views: 680 Well if you WANT to allow duplicates all you need is a std::vector |
Forum: C++ Sep 28th, 2009 |
| Replies: 23 Views: 680 >! myfile.eof()
using that is not advised.
And use std::string instead. |
Forum: C++ Sep 28th, 2009 |
| Replies: 1 Views: 790 maybe you'd have to use Curl or something to save the picture from the website onto your harddrive then call that function. |
Forum: C++ Sep 26th, 2009 |
| Replies: 17 Views: 24,463 Sounds like another fail, I dare people not to help you. |
Forum: C++ Sep 17th, 2009 |
| Replies: 3 Views: 579 set a variable at the beginning then add them all up:
eg.
int total = 0;
for ( int i = 0; i < 10; i++ )
{
total = total + i;
} |
Forum: C++ Aug 30th, 2009 |
| Replies: 2 Views: 293 I was thinking about using the modulus operator to get every third number, then just increment by ten to get the range...
#include <iostream>
#include <string>
#include <vector>
using... |
Forum: C++ Aug 27th, 2009 |
| Replies: 7 Views: 443 too+too+too+too=good (4 variables)
499+499+499+499=1996
http://www.mathforum.com/library/drmath/view/57968.html
http://www.geocities.com/Athens/Agora/2160/primer.html#HOW |
Forum: C++ Aug 27th, 2009 |
| Replies: 4 Views: 278 Woah, I don't understand the purpose of this.
Normally you pay for hosting on a website which gives you access to database. Those websites normally run php as the de facto as well.
You can... |
Forum: C++ Aug 26th, 2009 |
| Replies: 8 Views: 305 I know you can attach zip files to forum posts. Not sure about snippets. |
Forum: C++ Aug 26th, 2009 |
| Replies: 11 Views: 520 Maybe might be of use?
http://www.daniweb.com/code/snippet900.html |
Forum: C++ Aug 26th, 2009 |
| Replies: 8 Views: 305 That sounds like a good tutorial as it is quite a popular topic I can imagine.
If I remember the tutorials gets vetted but there is not from stopping you posting it as a snippet with comments for... |
Forum: C++ Aug 26th, 2009 |
| Replies: 2 Views: 200 Do you have a sample input file to post?
And sample input from the command prompt etc. |
Forum: C++ Aug 26th, 2009 |
| Replies: 3 Views: 1,172 This is a very useful snippet. Kudos. |