Forum: C++ Aug 12th, 2006 |
| Replies: 10 Views: 5,148 You know of a C++ book that goes over that stuff in detail?
I prefer Brad Jones' "Teach yourself C++ in 24 days".... In my opinion it covers material better than any other C++ book I've... |
Forum: C++ Jul 18th, 2006 |
| Replies: 4 Views: 1,111 I think it depends on the type of application. Java is similar to C++ in style, but you'll notice a speed difference on desktop apps right quick ;) I'd recommend going for .NET unless you're doing... |
Forum: C++ Jul 7th, 2006 |
| Replies: 1 Views: 1,862 Bjarne's book 'The C++ Programming Language". It has PLENTY of tough exercises at the end of each chapter. Some of them aren't exactly easy. |
Forum: C++ Jun 4th, 2006 |
| Replies: 5 Views: 3,447 Passing arrays is always a pain. I like how Dave just kept it in the public member section... Works out easier that way. |
Forum: C++ May 13th, 2006 |
| Replies: 11 Views: 2,727 I thought about dropping to the command line and using JEdit. |
Forum: C++ May 12th, 2006 |
| Replies: 11 Views: 2,727 I use Dev-C++ which does well with compiling, but I don't like the indentation mechanism of it. It doesn't properly align everything like it should... |
Forum: C++ Apr 30th, 2006 |
| Replies: 1 Views: 1,294 I would use a map, definately. Create the map and then when you go to insert something, it would be like this:
map.insert( make_pair("Dog","Big fury animal") );
That's how I would do it, but... |
Forum: C++ Apr 2nd, 2006 |
| Replies: 4 Views: 955 #include <windows.h>
Beep(int, int); |
Forum: C++ Apr 2nd, 2006 |
| Replies: 10 Views: 1,371 There's no relation. You can make about any object simulate a simple physics vector, but a C++ vector is just a container. If the name was different would you still think there's a relationship? |
Forum: C++ Apr 2nd, 2006 |
| Replies: 12 Views: 2,214 If you already know the syntax then do something mathematical that requires some thought and time to make. For instance: Maybe something simple to compute derivatives or an equation parser. A... |
Forum: C++ Mar 31st, 2006 |
| Replies: 16 Views: 2,044 Wow. Your stupidity becomes more prevalent with each post. I know you're still pissed about me letting you know how stupid your other post is, but that's not reason to carry over into someone... |
Forum: C++ Mar 30th, 2006 |
| Replies: 16 Views: 2,044 You haven't even got the user input.
set up variables properly:
int k = 0;
int n = 0;
prompt the user: |
Forum: C++ Mar 14th, 2006 |
| Replies: 5 Views: 2,745 I can see how you might have one class and one 'driver' program, but I don't understand why you would want more than one class.
You could create, of course, a roman numeral class:
class... |
Forum: C++ Jan 23rd, 2006 |
| Replies: 6 Views: 34,130 Not that it's important or anything, but you can initialize all the elements to a specific value:
vector< vector< double > > matrix( row, vector<double>(row, int_val)); |
Forum: C++ Jan 21st, 2006 |
| Replies: 6 Views: 4,990 It was actually my first choice to use strings. I would MUCH rather use them over char arrays, but all in all it was good practice, I guess. The reason I used char arrays is because it's the only... |
Forum: C++ Jan 20th, 2006 |
| Replies: 6 Views: 4,990 No, this was a different problem. I'm using an older version of bloodshed and it as some really weird lock on files, so once I switched over it worked fine. |
Forum: C++ Jan 20th, 2006 |
| Replies: 6 Views: 4,990 I have a program that reads from a file, but for some reason it never reaches the end of the file or something, because the loop never ends. I put only 2 lines of text in the file, and a loop like... |
Forum: C++ Jan 10th, 2006 |
| Replies: 3 Views: 2,307 Don't worry yourself about creating the spaces and aligning into a triangle.... Thanks to C++ you can set the width and fill character of the output ;) |
Forum: C++ Jan 9th, 2006 |
| Replies: 8 Views: 1,448 Alright, it worked. Thanks for all the help guys.
PS: Why would a compiler have problems with a double like that? |
Forum: C++ Jan 9th, 2006 |
| Replies: 8 Views: 1,448 Yeah, I'm downloaded the very latest version right now. I'll let you know how it goes. |
Forum: C++ Jan 9th, 2006 |
| Replies: 8 Views: 1,448 I'm using an older version of Bloodshed. I guess that could be the problem...... But if it works, then I will be extremememememmeemlllllyyyyyy happy. |
Forum: C++ Jan 9th, 2006 |
| Replies: 8 Views: 1,448 cout << "determinant = " << determinant;
;) |
Forum: C++ Jan 9th, 2006 |
| Replies: 8 Views: 1,448 This is my double:
double determinant = 2.8*5*-9.5;
It should print out -133, right?
It prints out some weird junk like: 1.8e + 04 |
Forum: C++ Dec 23rd, 2005 |
| Replies: 11 Views: 7,150 That's pretty sweet. I guess mine was blown way out of proportion. |
Forum: C++ Dec 23rd, 2005 |
| Replies: 11 Views: 7,150 This is my try at it. It may not be very good, but it works.
#include <iostream>
#include <algorithm>
#include <string>
#include <set>
using std::cout;
using std::endl; |
Forum: C++ Dec 23rd, 2005 |
| Replies: 11 Views: 7,150 Why not use a Set and specify the string size as a sorting criterion? That way, when you want to find the longest or shortest string it would be a one liner. |
Forum: C++ Dec 23rd, 2005 |
| Replies: 12 Views: 1,996 Here's your problem:
cust.check_type(type,balance);
You're calling that method on a vector? |
Forum: C++ Dec 1st, 2005 |
| Replies: 1 Views: 1,645 Try:
cout << "\\" << (an expression) << "\\";
\ is an escape sequence, so you must treat it with extra care. |
Forum: C++ Nov 26th, 2005 |
| Replies: 15 Views: 4,732 If you're working with strings this might work (not tested), but it looks like dragons solution is probably what your looking for.
bool find_string(ifstream& file, const string& search)
{
... |
Forum: C++ Nov 21st, 2005 |
| Replies: 6 Views: 1,660 So what's your question? I see nothing but a bunch of code in need of a few band aids, but no question. |
Forum: C++ Nov 16th, 2005 |
| Replies: 4 Views: 3,039 Multiple opinions are always good. |
Forum: C++ Nov 15th, 2005 |
| Replies: 2 Views: 1,417 If I remember right, the vector class is very slow when inserting elements to the front, or any place except the back. So, if there is a method push_front() then you probably shouldn't use it. |
Forum: C++ Nov 15th, 2005 |
| Replies: 4 Views: 3,039 I'd say no, but there's no way to tell. The best thing to do is ask your teacher/professor. You can always do both and that way you won't have to worry. |
Forum: C++ Nov 13th, 2005 |
| Replies: 5 Views: 1,240 You could simply loop through I guess:
bool anyNegatives(int nums[], int size)
{
for (int i=0; i<size; ++i)
{
if (nums[i] < 0)
{
return true;
} |
Forum: C++ Nov 5th, 2005 |
| Replies: 4 Views: 1,942 Oh, I see. I appreciate the help sunny. |
Forum: C++ Nov 5th, 2005 |
| Replies: 4 Views: 1,942 Well, I knew that would work, but I'm trying to split functionality up as much as I can. Is there not a way to have this Store class as an external source code and import it into the Person class?... |
Forum: C++ Nov 5th, 2005 |
| Replies: 4 Views: 1,942 I have a class Person and a Class Store. I didn't find any way to really inherit Store in class Person, so I created Class Store in a namespace called StoreClass.
In the person class this... |
Forum: C++ Nov 4th, 2005 |
| Replies: 9 Views: 1,748 Ok, I think I got it. Correct me if I'm wrong:
The first parameter(ostream&) is actually on the right side of the operator << and the object it's operating on is on the right side of the <<... |
Forum: C++ Nov 4th, 2005 |
| Replies: 9 Views: 1,748 Thanks guys, that really helped a lot and cleared things up. It turned out that I didn't declare it as a friend. Now, one thing I don't understand is where the ostream& is passed since it's the... |
Forum: C++ Nov 3rd, 2005 |
| Replies: 9 Views: 1,748 I have the following code:
ostream Person::operator<<(ostream& out, const Person& p)
{
out << "/n*********************************" << endl;
out << "Name: " <<... |