1,288 Posted Topics

Member Avatar for senait.kifle.127

Where you read a line of text into the variable "line" (on line 31 of your code, above), don't. Instead, create a string for storing the shelf number, and a string for storing the item name, and then read in the shelf number ( `file >> shelf_number;` ) and then …

Member Avatar for Moschops
0
2K
Member Avatar for yaya1234

If you really don't want to use a string object, you can read the file into your aray of char. It would be much better to use a string. http://www.cplusplus.com/reference/istream/istream/getline/ `myfile.getline(line, 120);` Using it as the condition in a `while` loop isn't going to work.

Member Avatar for yaya1234
0
2K
Member Avatar for writerervin

You would start by identifying the operating system you are going to write it for. You then learn that operating system's (and possibly window manager) API for graphics. For example, if you were going to target windows, you would learn the Win32 API, perhaps by starting here: http://www.winprog.org/tutorial/start.html (that's been …

Member Avatar for Moschops
0
292
Member Avatar for pronob.roy.3110

An array is some objects of the same type all next to each other in memory. A linked list is a set of objects of the same type, each of which contains a pointer to the next one. They could all be scattered anywhere in memory.

Member Avatar for Moschops
0
118
Member Avatar for Wajid sardar

If you tell people what the error message is, they can tell you what it means. As it is, it looks like you have cut and paste your code three times, over the top of itself, so you've presented us with a complete mess.

Member Avatar for Moschops
0
528
Member Avatar for chrisschristou

Because you're writing all your code in one project, you're trying to combine all your code into a single program. You're only allowed one function named `main` in a single program. Because you wrote lots of functions named `main`, you're breaking that rule. Separate project for each exercise.

Member Avatar for chrisschristou
0
2K
Member Avatar for csnerd2020

If you already have the class, you could do worse than simply change your existing code into template and see what happens. If you class, for example, looks like this: class Numbers { private: int theValue; public: int getValue(){ return theValue;} void setValue(int input){theValue = input;} }; you could just …

Member Avatar for Maritimo
0
191
Member Avatar for Pyler

There's no data there to store. Every BREAD object is identical to every other BREAD object. There's nothing to serialise.

Member Avatar for mike_2000_17
0
279
Member Avatar for ashhhh
Member Avatar for Jhon_3

If you read them in a piece at a time and overwrite the piece each time, you can make that piece as small as you like

Member Avatar for mike_2000_17
0
96
Member Avatar for benali.benzazoua

`#include` the header(s) so you can compile it, and tell the linker to link against the binary library file so you can link against it.

Member Avatar for Moschops
0
62
Member Avatar for samson.dadson.3_1

`cin.clear()` resets the error flags, but does not empty the buffer, so next time round the loop, there's already something in the buffer. You can use `cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');` to empty the buffer (requires `#include <limits>`). There are other options too.

Member Avatar for samson.dadson.3_1
0
2K
Member Avatar for melusi_1

The very simple algorithm for finding x is shown at the right of the Wiki page: http://en.wikipedia.org/wiki/Quadratic_formula

Member Avatar for Moschops
0
135
Member Avatar for aida.atef.31

`else if (X=Y)` In C++, `=` is the assignment operator. `X=Y` means "make X have the same value as Y". The operator you want here is `==`.

Member Avatar for vijayan121
0
253
Member Avatar for furalise

If your aim is to use existing libraries, you need to know almost nothing about how they were made. The point of a library is that someone else has already done all the making for you, so that you don't need to worry about the details. All you need to …

Member Avatar for Moschops
0
185
Member Avatar for COKEDUDE

You can expect to get a segFault when you try to read or write to memory that the operating system thinks does not belong to that program. So if you have an area of memory allocated to your program, and your array is somewhere inside that area of memory, what …

Member Avatar for Moschops
0
146
Member Avatar for andruluchko

THe class variable named `city` is a `char`. A single `char`. It can hold one letter. Just one. It cannot hold Kyiv, because Kyiv is four letters. Change it to a `string`. THe class variable named `country` is a `char`. A single `char`. It can hold one letter. Just one. …

Member Avatar for Moschops
0
191
Member Avatar for Sunil_12

You need to link against the library that contains the function moveto, setbkcolor, setcolor, linerel, grapherrormsg, graphresult, initgraph.

Member Avatar for Sunil_12
0
318
Member Avatar for Search_not

This line ` cin >> ov.Rock;` in your main function calls the operator function `istream& operator>> ( istream& is, RockName& name )` That function contains `is >> ov.Rock;` which calls the operator function `istream& operator>> ( istream& is, RockName& name )` which contains `is >> ov.Rock;` which calls the operator …

Member Avatar for Search_not
0
3K
Member Avatar for rela

What is WriteModel()? It's not standard C++; it must be some function you got from somewhere. What is it?

Member Avatar for rela
0
174
Member Avatar for Glaven

`} while (!input==1);` In C++, the not-equals logical test is `!=`, so try `} while (input!=1);` Anyway, you're testing the variable `input`. But you never change that variable. What is the variable `total` for? It's useless here. Remove it, and do your division operations on `input`.

Member Avatar for NathanOliver
0
744
Member Avatar for Search_not

I think this might be what you're trying to do. Note that in your code, you wrote declarations for the overloaded operators, but you didn't actually write any code for them. #include <iostream> using namespace std; class Temp{ double fTemp; public: double FahrToCelsius(){ return (fTemp - 32.0) / 1.8; } …

Member Avatar for Search_not
0
778
Member Avatar for Shiksha

http://www.thecrazyprogrammer.com/2013/01/download-turbo-c-for-windows-7-for-free.html I assume you're being forced to write programs for a 16bit DOS machine in the year 1990. If you ever have to write programs for modern computers, you'll need to change your tools.

Member Avatar for Shiksha
-1
238
Member Avatar for last1devil

In your function `sendToDisplay`, the object named `digits` is a single int. So what are you trying to do here: `digits[i]` ? `Digits` is an int. Not an array. Likewise for `value`. `value` is a single char. Not an array.

Member Avatar for last1devil
0
246
Member Avatar for aluhnev

Within a class' member functions, you can use that class' member variables directly. That's simply how classes work. The function `CTime_24 CTime_24 :: operator+(int seconds)` is a class function of the class CTime_24, so you can directly access the class' members. Accessing a class' members by getting a pointer to …

Member Avatar for aluhnev
0
151
Member Avatar for ceelos1974

Build it with debugging symbols inserted, and then run it under a debugger. The debugger will show you the line of code it crashes on and allow you to examine the variables to see what the problem is.

Member Avatar for ceelos1974
0
234
Member Avatar for ziarashdi26
Member Avatar for NathanOliver
0
139
Member Avatar for SumTingWong59

Open input file. Get each word one at a time. If word == A: Get the next word v = that next word

Member Avatar for SumTingWong59
0
208
Member Avatar for abdul rahman 2
Member Avatar for deceptikon
0
92
Member Avatar for lewashby

The code does not all have to be on one line. https://isocpp.org/wiki/faq/inline-functions#inline-member-fns

Member Avatar for deceptikon
0
130
Member Avatar for rayhaneh

You seem to be trying to declare a function, `pow`, twice. You also never define it. Anyway, it's complaining about this line: `cin>>a1>>a2>>a3>>a4;endl;` What is that `endl` for?

Member Avatar for Moschops
0
129
Member Avatar for Malkolm

Here, you set the variable total: int numdQuotes = 0; int total = numdQuotes/2; This sets it to the value 0, because at this moment, `numdQuotes/2` is zero. Your code never touches the variable `total` again, so it remains zero forever, so when you output it to screen, it's zero.

Member Avatar for L7Sqr
0
291
Member Avatar for rose_2

Good for you. Well done. Here are some problems with it: Line 2 - conio is a non-standard header and using it comes with risks. Modern typical PC systems do NOT come with anything named conio, so by using it you're already restricting yourself. Don't use it. Line 3 - …

Member Avatar for tinstaafl
0
151
Member Avatar for aulia.septadinarty

It means you have to show us the file named `final project uts.cpp` Make sure you don't miss out line 41.

Member Avatar for Moschops
0
43
Member Avatar for gothv

Instead of `if (menu_selection==a)` try `if (menu_selection=='a')` You don't need to create varables named a, b, c and d on line 40. While I'm here, `void main()` is wrong. In C++, `main` returns an int. Always. There is no option. In C++, `main` returns an int. If your compiler lets …

Member Avatar for gothv
0
232
Member Avatar for Pyler

The biggest problem with the code here (apart from the spelling mistake on line 2 of the header file) is that you're creating a pointer-to-a-rectangle like this (remember that `new` creates an object on the heap memory, and gives back a *pointer* to that object): ` new rectangle(3,4);` and then …

Member Avatar for Moschops
0
176
Member Avatar for Ndangoh Joseph

The short answer is you can't (without doing some more work). See that string you typed, "monday"? That does not exist once the compiler is finished. It's in your source code, typed in with all the other things you typed, but in the finished program there are no strings "monday", …

Member Avatar for Moschops
0
129
Member Avatar for Riya_2

You need to loop over every char in the string. Subject each char to the function `is_vowel`. Count how many times the function comes back as true. Return that total.

Member Avatar for Schol-R-LEA
0
196
Member Avatar for Neha_11

Is that everything it says? I most commonly see that error with an undefined symbol, but in those cases it should say which symbol is undefined. Alternatively, it's trying to create a file somewhere that it does not have permission to, and then when it looks for that file, it …

Member Avatar for Moschops
0
219
Member Avatar for myk45

On a typical \*nix installation, `ldd executableName` will give you a listing of the dynamic libraries it uses.

Member Avatar for L7Sqr
0
152
Member Avatar for DS9596

That builds and runs fine. My guess is that it finishes very quickly because it can't find the datafile and you don't even realise it ran and finished.

Member Avatar for cgeier
0
183
Member Avatar for Xavier_1

What input do you give it, what output does it give back, what is it about the output that do you not like? If you're going to use floating point values, you need to read this: http://floating-point-gui.de/ If you're going to use floating point values for financial information, you need …

Member Avatar for Moschops
0
198
Member Avatar for Joshua_9

The mean of the numbers 3123, 1412 and 2412 is 2316 (not 1414), and the variance of them is also not what you stated. Are you using some alternative definition of these terms?

Member Avatar for David W
0
541
Member Avatar for iikitty

I have no idea what your code is trying to do. > the longest sequence the number has within the 2-number range What does that mean? The entire set of numbers is a sequence, and every subset of the numbers is a sequence.

Member Avatar for Moschops
0
257
Member Avatar for nitin1
Member Avatar for Shibbir Khan

`carry_bits |= ((a & mask) & (b & mask)) << 1u;` When a is 1, `a & mask` is 1, or in binary 00000001. When b is 1, `b & mask` is 1, or in binary 00000001. So `((a & mask) & (b & mask))` is` 00000001 & 00000001`, which …

Member Avatar for Moschops
0
206
Member Avatar for glao

Unless I'm reading this wrongly (because you have written this in a somewhat odd style with more layers of pointer redirection than you need), you are allocating enough space for 2 int values, and then trying to store ten int values in that space, so you're writing over eight int …

Member Avatar for glao
0
882
Member Avatar for Silfro

Just copy the data. sStruct1 first; sStruct2 second; ... first.Base1 = *(second.Base1); first.Base2 = *(second.Base2); first.Base3 = *(second.Base3); ... *(second.Base1) = first.Base1; *(second.Base2) = first.Base2; *(second.Base3) = first.Base3;

Member Avatar for uonsin
0
257
Member Avatar for asdsadddsadsd

If you're only allowed to use if statements, what is the meaning of `arrange these numbers`? You have no way to move them around into an order, because they're not contained in anything, so when you say "arrange" what do you mean? How do you know you can't use an …

Member Avatar for uonsin
0
447
Member Avatar for rose_2

The End.