1,288 Posted Topics

Member Avatar for erinkay528

`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 …

Member Avatar for Moschops
0
1K
Member Avatar for andrew12s

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 …

Member Avatar for rubberman
0
148
Member Avatar for cocopium

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 …

Member Avatar for Gonbe
0
290
Member Avatar for laurel.jackson.12

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.

Member Avatar for tinstaafl
0
149
Member Avatar for soche123

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 …

Member Avatar for tinstaafl
0
707
Member Avatar for nitin1

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 …

Member Avatar for deceptikon
0
134
Member Avatar for eldiablo1121

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.

Member Avatar for eldiablo1121
0
2K
Member Avatar for J-P1988

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.

Member Avatar for J-P1988
0
883
Member Avatar for lewashby

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 - …

Member Avatar for vijayan121
0
231
Member Avatar for Suraj_1
Member Avatar for Ancient Dragon
0
208
Member Avatar for rofln

When you say it's a textfile named Makefile, do you mean it is named `Makefile` or `Makefile.txt` ?

Member Avatar for rofln
0
129
Member Avatar for Labdabeta

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 …

Member Avatar for Labdabeta
0
208
Member Avatar for nathan.pavlovsky

You've used different names for the function in the declaration and definition. void squareByReference(int&); void squarebyReference(int& numRef)

Member Avatar for nathan.pavlovsky
0
206
Member Avatar for MasterHacker110

> 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 …

Member Avatar for MasterHacker110
0
202
Member Avatar for no_one16

Possibly silly question; does it even have to be in C++? I ask as you seem very lost.

Member Avatar for kvahanyan
0
154
Member Avatar for me.rohitverma

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 …

Member Avatar for Moschops
0
278
Member Avatar for hackoman96

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. …

Member Avatar for TheApex
-2
172
Member Avatar for TEJESH_1

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?

Member Avatar for misi
-1
123
Member Avatar for atulnain007

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();

Member Avatar for rubberman
0
187
Member Avatar for piczim

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?

Member Avatar for rubberman
0
186
Member Avatar for soche123

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: …

Member Avatar for tinstaafl
0
119
Member Avatar for adil.ghori

#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++.

Member Avatar for adil.ghori
0
386
Member Avatar for pooh1234qwerty

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;`

Member Avatar for JasonHippy
0
177
Member Avatar for arunkishorres

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.

Member Avatar for Moschops
0
352
Member Avatar for sireiz

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++ …

Member Avatar for sireiz
0
438
Member Avatar for sireiz

Duplicate thread here: http://www.daniweb.com/software-development/cpp/threads/457453/cannot-write-the-data-in-the-file-no-error-in-the-program

Member Avatar for Moschops
0
343
Member Avatar for SpottyBlue

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. …

Member Avatar for Moschops
0
159
Member Avatar for shane.shaffer.50

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

Member Avatar for iamthwee
0
209
Member Avatar for saurabh.mehta.33234

The comma operator means `n==5?printf("Hallo"):printf("Hai")` is evaluated, then `printf("Bye")` is evaluated. The `if` statement is doing nothing here.

Member Avatar for Moschops
-1
238
Member Avatar for sireiz

The function Storefile takes four char\* parameters. You're trying to call it with none.

Member Avatar for sireiz
0
199
Member Avatar for Knoxarama
Member Avatar for JoeD1

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'.

Member Avatar for JoeD1
0
165
Member Avatar for nitin1
Member Avatar for mahesh113

It's not specified. Could be in any order. http://en.cppreference.com/w/cpp/language/eval_order

Member Avatar for rubberman
0
138
Member Avatar for Suzie999
Member Avatar for bebesilang
Member Avatar for MRehanQadri

` 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;`

Member Avatar for Ancient Dragon
0
402
Member Avatar for alaba81

`=` 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?

Member Avatar for Moschops
0
2K
Member Avatar for subash sonar
Member Avatar for wumeed

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 …

Member Avatar for Ancient Dragon
0
151
Member Avatar for eldiablo1121

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? …

Member Avatar for Moschops
0
198
Member Avatar for cocopium

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, …

Member Avatar for cocopium
0
503
Member Avatar for Abhinisha
Member Avatar for sumisimmy

Show user list of food. Get from user how much of which food. Show user the cost. How far have you got so far?

Member Avatar for sumisimmy
-1
119
Member Avatar for subash sonar

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 …

Member Avatar for subash sonar
0
153
Member Avatar for deceptikon

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 …

Member Avatar for deceptikon
5
224
Member Avatar for nathan.pavlovsky

int* Board::accessColCount() { return colCountArray; } This will return an int-pointer, pointing inside the board objdect, to its colCountArray.

Member Avatar for rubberman
0
115
Member Avatar for costy.bogdan

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 :)

Member Avatar for costy.bogdan
0
120
Member Avatar for chlyre
Member Avatar for new_developer

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.

Member Avatar for rubberman
0
419

The End.