1,288 Posted Topics
Re: `if (fMembership == 'y' || 'Y')` This says: if either of the following two things are true, do the following code: 1) fMembership is 'y' 2) 'Y' Note that 2) is NOT fMembership is 'Y'. it's just 'Y'. Will just 'Y' ever, EVER be false? No, it will not. So … | |
Re: You have promised the compiler that you will create the following functions: Crowd(int m_number, int* m_element); Crowd(Crowd&); ~Crowd(); Crowd& operator= (Crowd& m); Crowd operator+ (Crowd& m); Crowd operator* (Crowd& m); Crowd operator- (Crowd& m); Friend ostream& operator << (ostream& o, Crowd& m); Start at the top. The first function, the … | |
Re: Programming is thinking. All the rest is just learning syntax. Welcome to programming. How would you do this on paper? Serious question. Once you understand how YOU would do this, on paper, in a methodical way, you'll understand how to program it. Maybe something like this: Presumably you would start … | |
Re: Your function displayZip contains this line: `cout << zipCode << " " << cityName << endl;` so it displays the zipCode and the cityName. If you don't want it to display the cityName, remove that from the code. | |
Re: Don't send us the code. Post the code. #include <cstdlib> #include <iostream> #include <conio.h> using namespace std; int i; int size=0; struct employRecord { string firstName; string lastName; int age; string department; string qualification; }; void addRecord(); void listRecord(); void modifyRecord(); void deleteRecord(); struct employRecord empl[100]; int main() { char … | |
Re: As you stated, it is entirely up to the implementer how they achieve this, and they are free to do it however they like. Here is one way it has been done, in glibc Version 2.15; the call to rand ends up at the function __random_r in this implementation http://sourceware.org/git/?p=glibc.git;a=blob;f=stdlib/random_r.c;hb=glibc-2.15#l361 … | |
Re: Line 178 should only trigger one time in three. Each time make it increment a counter. When the counter reaches 3, reset it to zero and only then output the endl. | |
Re: The error indicates that you're trying to access part of the list that does not exist. For example, if the list is of size 3, and you ask for the object at position 3 (because the objects are labelled 0, 1, 2), this error will occur. | |
Re: So you're taking a `char`, `processTheseThree[0]` or something like that, which is '1', and then you're telling the compiler to interpret it as an `int`? I would expect that to come out as the int value 49, because the char '1' is stored as the value 49 in memory - … | |
Re: What kind of integer value? `int`? `short`? `long`? Something else? | |
Re: When you say it's a textfile named Makefile, do you mean it is named `Makefile` or `Makefile.txt` ? | |
Re: There's really only one way to be sure; you have to measure. Either with some kind of code analysis tool that monitors how long functions take, or by sticking in logging and recording the time, or whatever other ways you can think of, but trying to guess what's taking up … | |
Re: You've used different names for the function in the declaration and definition. void squareByReference(int&); void squarebyReference(int& numRef) | |
Re: > And any more advice on what can be done better will be apreciated. If you better describe the problem, it will help a lot. Which line is going wrong? Or is it a function you can't get right? Is it the design you're struggling with? Does this compile? Does … | |
Re: Possibly silly question; does it even have to be in C++? I ask as you seem very lost. | |
Re: You appear to have posted the same mess repeatedly, which is also not helping at all. Line 2189 (and identically at line 707 and line 1448, because you've pasted the same thing repeatedly) seems to be the start of a function definition. It also appears to be inside another function … | |
Re: C++ can directly specify the commands to be run on the processor, so with C++ the processor can be made to do anything it is capable of. > just tell me about anythi9ng which can b hacked?? Examples of things that can be hacked; operating systems, programs, hardware, networks. Everything. … | |
Re: What operating system are you using? Are you running it on something like Windows 7, through a torturous maze of virtual machines and emulators to get your modern machine to pretend to be a 30 year old DOS system? ![]() | |
Re: What function are you using to generate your random number? Use that function each time you want a new random number. If you want more than 1 random number, you'll have to call the function more than once. For example: int first_random_number = rand(); int second_random_number = rand(); | |
Re: Presumably you are already running it in windows, so "get this to work as a windows program" doesn't make a lot of sense. What do you mean? | |
Re: decimalNumberToCovert[1]; Spelling error. You missed an 'n'. Also, when you make an array of size one, which is what you did, the elements start at element ZERO. So this:`long long decimalNumberToConvert[1] ;` creates an array of a single long long, which you can get access to like this:`decimalNumberToConvert[0] ;` This: … | |
Re: #include <iomanip> std::cout << std::setprecision(2); I note that you are using C++ from before 1998, so you might have to change iomanip to iomanip.h or some other such pre-standard, ancient C++. | |
Re: Because that's how C works. This: `char* a,b;` creates two variables. a is a char\*, b is a char. They are NOT both pointers. If you want them both to be pointers: `char *a, *b;` | |
Re: This means the function named `identical` with that signature cannot be found anywhere. If it's your own code, you haven't written that function. If it's some other code, you haven't linked that library. | |
Re: You never set the values `VUID campusID Studentname Fathername` in the student object when you create it. While I am here, I would be remiss if I did not point out that you are using mutant pre-standard C++ from about twenty years ago. Since 1998, we have used `namespace`s, C++ … | |
Re: Duplicate thread here: http://www.daniweb.com/software-development/cpp/threads/457453/cannot-write-the-data-in-the-file-no-error-in-the-program | |
Re: We're not going to simply do your homework for you; you need to ask questions, or tell us what error or warning you are getting, or ask about how to do something that you don't understand, or ask why something is happening that you think shouldn't happen, and so on. … | |
Re: I suggest you start with one of the simpler cross-platform GUI toolkits, also known as a widget toolkit. http://en.wikipedia.org/wiki/List_of_widget_toolkits#Cross-platform ![]() | |
Re: The comma operator means `n==5?printf("Hallo"):printf("Hai")` is evaluated, then `printf("Bye")` is evaluated. The `if` statement is doing nothing here. | |
Re: The function Storefile takes four char\* parameters. You're trying to call it with none. | |
Re: Please post the errors the compiler gives with the above code. | |
Re: I get the following output: `'f' is an invalid choice 0` which looks like it doesn't give a decimal value for the char sign. It gives an 'f'. | |
Re: https://en.wikipedia.org/wiki/Single_precision | |
Re: It's not specified. Could be in any order. http://en.cppreference.com/w/cpp/language/eval_order | |
Re: What you're describing sounds like a compiler. | |
Re: How far have you got? Are you able to take in a sentence from the user? | |
Re: ` cout << *p << endl;` What is \*p ? It is a single char, so you get a single char output. If you want to output the whole thing, use cout with the char pointer: `cout << p;` | |
Re: `=` is assignment. `x = y` means: make the value of z the same as the value of y. `==` is comparison `x == y` means: is x the same value as y? | |
Re: Anything you create in your code like this - `"some letters"` - you cannot write over. It is a *string literal* and is read-only. If you copy a string literal into a char array, you can of course then write over your own char array, but you cannot write over … | |
Re: You appear to be trying to store all the array like this: ` cin >> list1[5];` This means "take something from the keyboard and store it in the sixth element of the array named list1". Tell me, what is the size of that array? Does it have a sixth element? … | |
Re: Can you use the ternary operator, like this? ` (A > B) && (A > C) && (A > D) ? max = A: ;` You could put the elements into an array, sort them using loops (and less than four `if` statements) and then you would know they're sorted, … | |
Re: Show user list of food. Get from user how much of which food. Show user the cost. How far have you got so far? | |
Re: There is only one kind of header file in C++. It's a plain text file and it gets put into your code wherever you `#include` it. It's up to you what you put in it, but I suggest you put in it things you would have to write many times … | |
Re: If we're doing tales from the interview, which is always something good to do, I have a tale from *after* the interview; after being told for over a week "we'll tell you tomorrow" they apparently had a review today in which they discovered that rather than needing multiple people in … | |
Re: int* Board::accessColCount() { return colCountArray; } This will return an int-pointer, pointing inside the board objdect, to its colCountArray. | |
Re: Is this what you meant? char[10] arr="torino"; char* ptr; ptr=arr; cout << *&*&ptr; Also, this looks like C++. Next time, post it in the C++ forum :) | |
Re: Read code. Write code. Debug code. Rinse and repeat. | |
Re: To add a little to Lucaci's words, any string in your code you make like this: `"some letters"` is a *string literal*. It is for reading only. Trying to write to that memory is forbidden. Look up *string literal* for all the details. |
The End.