Forum: C++ 31 Days Ago |
| Replies: 9 Views: 318 You are confused. The null (\0) character doesn't get put there magically by the compiler. If you want to be able to treat that char array as a string, YOU have to allow space for the null... |
Forum: C++ Oct 20th, 2009 |
| Replies: 9 Views: 318 Your printing problem is not because there's anything wrong with the arrays. It's because of the way you are printing.
So I guess that's a "yes" to your last question. |
Forum: C++ Oct 20th, 2009 |
| Replies: 9 Views: 318 Sorry, I wasn't paying attention to the rest of the constructor. The problem there is that if you give a char array to cout, it will print everything starting at the beginning of the array and... |
Forum: C++ Oct 19th, 2009 |
| Replies: 9 Views: 318 I think you will have to show how you are outputting the arrays for anyone to tell what is going wrong with that.
Also, have another look at this:for(int alter = 0; alter < 26; alter++)
{... |
Forum: C++ May 16th, 2009 |
| Replies: 3 Views: 191 It would be much easier & make more sense to define
struct student{
int age;
string name;
} outside of any class. Then you can instantiate a student in any class that needs to have one, and use... |
Forum: C++ Apr 20th, 2009 |
| Replies: 7 Views: 357 PS: multiple program files are not input/output files. When your program is in a single file you don't "call" that file in the program, do you? Well, in a multi-file program you don't "call" these... |
Forum: C++ Apr 20th, 2009 |
| Replies: 7 Views: 357 I've already told you twice, but you don't want to believe me. I'll try again: You don't call the cashier file. You simply call the function cashiermenu(), or whatever it's called, exactly the same... |
Forum: C++ Apr 19th, 2009 |
| Replies: 7 Views: 357 You shouldn't have to write anything differently. You just include the header file for the function you want to call in the implementation file of the calling function. The calling function (let's... |
Forum: C++ Apr 19th, 2009 |
| Replies: 7 Views: 357 Are you planning on having your program write something to a file with that name? (I don't think so.)
A multi-file program doesn't involve anything like opening up other source code files while... |
Forum: C++ Apr 19th, 2009 |
| Replies: 1 Views: 575 The correct syntax for calling a method of an instance of a class is:
objectName.method(args)
In your case:
cout << "Currently on the list are: " << mylist.display() << endl;
That may or may... |
Forum: C++ Apr 19th, 2009 |
| Replies: 7 Views: 706 As far as largest_prime_factor() is concerned, a few observations:
- largest_prime_factor() returns a value, but your main() ignores the return value. If you want to use the return value, main... |
Forum: C++ Apr 19th, 2009 |
| Replies: 7 Views: 706 Try running it with
> Enter your first name and surname: alec baldwin |
Forum: C++ Apr 18th, 2009 |
| Replies: 2 Views: 805 Did you read this:
http://www.daniweb.com/forums/announcement8-3.html |
Forum: C++ Apr 18th, 2009 |
| Replies: 7 Views: 706 That's easy - squared-digit-length() isn't returning anything because you removed the return statement. And even if you restore the return statement, sometimes it won't return because, depending on... |
Forum: C++ Apr 18th, 2009 |
| Replies: 7 Views: 706 I didn't try compiling/running it, but it seems to me that it might take a long time to get out the first call to squared_digit_length() unless num1 equals 2, and that won't happen unless the user's... |
Forum: C Apr 16th, 2009 |
| Replies: 10 Views: 1,380 Did you add xxx.cpp to the project? I see nothing in the code you posted that should cause your problem, but the code you are posting is just uncompilable snippets. You need to post some simple,... |
Forum: C Apr 16th, 2009 |
| Replies: 10 Views: 1,380 In xxx.h and xxx.cpp you have ExecuteBCombine, in main you have ExecuteBinaryCombinations, and yet the error message refers to ExecuteBCombine referenced from main? Is there a discrepancy like this... |
Forum: C Apr 16th, 2009 |
| Replies: 10 Views: 1,380 In the above code, there are two completely distinct and unrelated variables both named b_setting. The first one declares a variable of type char* that is defined elsewhere -- in this case in... |
Forum: C Apr 15th, 2009 |
| Replies: 10 Views: 1,380 See comments below:
//main.cpp
#include "xxx.h";
char b_selection [100]="";
void main(){
ExecuteBCombine (b_selection); } |
Forum: C Apr 3rd, 2009 |
| Replies: 10 Views: 542 Sorry, I was wrong about <stdio.h>.
#include <errno.h> should get it -- somewhere down the chain of includes.
errno.h includes bits/errno.h includes linux/errno.h includes asm/errno.h includes... |
Forum: C Apr 3rd, 2009 |
| Replies: 10 Views: 542 Did you #include <stdio.h>? |
Forum: C Apr 3rd, 2009 |
| Replies: 9 Views: 839 There's no bool type and no true and false constants in standard C before C99 (and in C99 you must #include <stdbool.h>) I don't know about Visual C.
You can typedef enum { false, true } bool.
... |
Forum: C++ Mar 25th, 2009 |
| Replies: 3 Views: 449 remove the semicolon from the end of this line
else (*type == 'C' || *type == 'c'); |
Forum: C Mar 23rd, 2009 |
| Replies: 11 Views: 781 Here's how it works: It enters the first while loop, reads the first line, stores it in the "line" array, then makes x=1, then it does "nothing" because of theif( x == 1 )
{ //nothing in here
... |
Forum: C Mar 22nd, 2009 |
| Replies: 11 Views: 781 Yes, you said that already, but it still makes no sense to me for that to be in the input file. Surely, the program doesn't need that to figure out which data is in which column of the file. A file... |
Forum: C Mar 22nd, 2009 |
| Replies: 11 Views: 781 There are many ways to do this. Probably getc or fgetc would be the simplest for you. Look at a reference for stdio.h functions, for example this one, to see how to use those functions:... |
Forum: C Mar 21st, 2009 |
| Replies: 11 Views: 781 Is all this stuff:01234012345678901234567890123456789
0123401234567890123456789012345678901234567890123456789012345678901234567890123456789
No Matrix quiz1(5%) quiz1(5%) quiz1(5%) Proj(25%)... |
Forum: C++ Mar 16th, 2009 |
| Replies: 14 Views: 747 You are not making yourself clear. Looking at the code you posted in Post #11, beginning on the line
BETA =45; /* defining constants*/
through and including the line
h=Pb,,
everything is... |
Forum: C++ Mar 15th, 2009 |
| Replies: 14 Views: 747 You say C++ but you seem to be using C, as you #include <stdio.h> and use printf for printing. So, assuming you are using a C compiler, you should also #include <math.h> at the top of your program,... |
Forum: C++ Mar 13th, 2009 |
| Replies: 14 Views: 747 You want to apply one value using the F_PROFILE function to points on your line, and another value using that function "everyplace else", but in C you must define points in terms of discrete values... |
Forum: C++ Mar 13th, 2009 |
| Replies: 14 Views: 747 Perhaps you intended a test for equality (==), rather than assigment (=). And why the unnecessarily confusing multiplication by -1 in the first expression and double negative in the second?
This... |
Forum: C++ Mar 13th, 2009 |
| Replies: 14 Views: 747 Is this supposed to be C++ or is it some other language? |
Forum: C++ Mar 9th, 2009 |
| Replies: 9 Views: 459 OK, when I posted last night I didn't realize that that you were talking about a graph with cycles, since you were calling it a tree with a root, parents and children (by definition, trees don't have... |
Forum: C++ Mar 9th, 2009 |
| Replies: 9 Views: 459 Well, maybe I'm too tired to think this all the way through, but it seems like the children can have children which have children ... so your del would have to recurse all the way down through the... |
Forum: C++ Mar 5th, 2009 |
| Replies: 9 Views: 397 All of that is true, but it is also very non-trivial for a beginning programmer to write portable code to clear any kind of screen on any kind of computer. |
Forum: C++ Mar 3rd, 2009 |
| Replies: 9 Views: 397 Good point. When you put calls to menu() inside menu(), you are inadvertently making unnecessary recursive calls to the menu() function, meaning you will be loading multiple copies of the function... |
Forum: C++ Mar 2nd, 2009 |
| Replies: 9 Views: 397 That's because you are never actually calling the function addEnd (even though you think that you are), because you still haven't fixed the errors that I pointed out in post #2.
Your code still... |
Forum: C++ Mar 2nd, 2009 |
| Replies: 9 Views: 397 Notice this statement near the beginning of menu(): if(select = 1)
As soon as your program gets to that point it assigns 1 to select, instead of testing to see if select equals 1. This overrides... |
Forum: C++ Mar 2nd, 2009 |
| Replies: 4 Views: 308 What are you trying to do here:if (gross1, gross2, gross3, gross4, gross5 < THREE_HUNDRED)and heretaxamount = gross1*taxdeduct, taxamount = gross2*taxdeduct, taxamount = gross3*taxdeduct, taxamount =... |
Forum: C++ Mar 1st, 2009 |
| Replies: 2 Views: 406 Well, you already know that you're concatenating in the wrong order so you don't need any suggestions regarding that (just fix it), so here are a few other things to think about:
Your code has to... |