1,288 Posted Topics

Member Avatar for markdean1989

What happens if you rewrite lines 9 and 10 to use forward slash rather than backward slash? infile.open("C:/Projects/C++/infile.txt"); outfile.open("C:/Projects/C++/outfile.txt");

Member Avatar for markdean1989
0
363
Member Avatar for Marz_1

You can tell gcc specific directories to search for libraries with the -L switch, e.g. `-L/some/directory/that/you/know/the/library/is/in` On Linux, you don't have to bother doing all this yourself as there's a helpful expanding config to do it for you that you add to your gcc line; `sdl-config --cflags --libs` ( https://wiki.libsdl.org/FAQLinux#How_do_I_add_SDL_to_my_project.3F …

Member Avatar for Moschops
0
224
Member Avatar for DS9596

In what way does it "not let you"? Does the keyboard refuse to accept any entry when you get to the operator selection?

Member Avatar for DS9596
0
282
Member Avatar for cambalinho
Member Avatar for uws101

You create a pointer, named `datas`. You don't set it to point at anything, so it's pointing at some random memory somewhere. You then pass the address of that pointer to your readwav function; a pointer to a float-pointer. The function `readwav` calls this `buffer` and treats it as an …

Member Avatar for rubberman
0
141
Member Avatar for Faissalelbarhami

Programming is thinking. How would you do this on paper? If I gave you two sheets of paper with writing on, and asked you to find the first difference, how would you do that?

Member Avatar for Faissalelbarhami
0
390
Member Avatar for Nataliya_1

On line 27, you make `current` and `num` the same. So the condition on line 30 will never be true, and line 32 will never happen. Is the condition on line 30 the correct thing to be comparing? Shouldn't you be comparing something against `highest`?

Member Avatar for Moschops
0
215
Member Avatar for Mr.M
Member Avatar for Search_not

The obvious first response is don't build it on the heap. You're creating it and destroying it all within the function `change_registry_config`, so just make it on the stack (i.e. don't use `new`) and you don't have to worry about memory.

Member Avatar for rubberman
0
145
Member Avatar for dvamshi0608
Member Avatar for brandon66

Line 26 is testing for zero. I suspect you meant `=` rather than `==` You could have found this by printing out the values of the array after you zeroed it, to check it was being set correctly at the start.

Member Avatar for Moschops
0
200
Member Avatar for vell

int count; int distance; If you couldn't do that on your own, you really, really need to go right back to the beginning and start again.

Member Avatar for rubberman
0
61
Member Avatar for Anil_7

`graphics.h` was a header file provided, along with a library, by some compiler bundles back in the eighties and early nineties. It is not part of the C++ standard. It was something extra that some compiler vendors provided to customers, so they could do some graphics work on their computers. …

Member Avatar for Moschops
0
109
Member Avatar for ifra.raja.1
Member Avatar for aliasadullah
Member Avatar for Lardmeister
-1
177
Member Avatar for Ahmad Imran

**It was meant as a test.** Well, obviously this forum fails your test. Please give up here and try some other forum.

Member Avatar for deceptikon
0
330
Member Avatar for Smn

I see people using Turbo C++ sometimes, but this might be my first spot of plain Turbo C in the wild :p For the history buffs, the last version of Turbo C was released in 1989, and made 16 bit executables for DOS. For those to whom that means nothing, …

Member Avatar for mike_2000_17
0
3K
Member Avatar for cypherscouter13

What happens if you run the actual binary using gdb? So don't start it with a shell script. Just run the binary. `gdb <binary executable>` and then `run`

Member Avatar for Moschops
0
264
Member Avatar for Rahul47

Are you reading this input from the keyboard, or from a file, or will it be presented to you as some data object?

Member Avatar for Rahul47
0
214
Member Avatar for petrarobert002

Get a compiler that can deal with objective-C and start programming. If you're stuck on windows, the MinGW port of GCC handles objective-c, so long as you remember to get the optional objective-c bits with it. If you can use Linux or mac OSX, it'll be easier. What will you …

Member Avatar for Jack_11
0
408
Member Avatar for igli_1

Create two numbers. Call the first one number_of_spaces. Call the second one number_of_stars. Set number_of_spaces to zero. Set number_of_stars to five. Now output number_of_spaces spaces, and number_of_stars stars. Add one to number_of_spaces, subtract one from number_of_stars. Repeat previous two instructions until you're done. Welcome to programming. Programming is thinking. When …

Member Avatar for Maritimo
0
182
Member Avatar for Ola Loay

Start at the beginning. **Q1: Write a for loop to fill-in the array with data.** So write a program that creates the array, and when that is working, add a for loop to fill the array with data. Do you know how to write an empty program that does nothing? …

Member Avatar for Moschops
0
194
Member Avatar for rose_2

You've missed a semi-colon on line 11. Your `for` loop will go round 11 times instead of 10. Other than that, nothing. If you enter 11 marks you'll get an average mark. What makes you think it doesn't work?

Member Avatar for rose_2
0
140
Member Avatar for fawadali

`printf("*\n***\n*****\n*******\n*********\n*********\n*******\n*****\n***\n*");`

Member Avatar for dbfud1988
0
194
Member Avatar for hira_5

In C++, the `main` function doesn't go in a class. Maybe you're thinking of Java.

Member Avatar for sfuo
0
118
Member Avatar for nitin1

All three do the same thing. They look at every element in the array, one at a time, and stop when they find the value you're looking for. You have removed a little bit of loop overhead from the second, and a little bit more of the loop overhead from …

Member Avatar for Duoas
0
211
Member Avatar for ALEXANDER R

Here is a thread you should read that will enable you to ask a better question. https://www.daniweb.com/software-development/cpp/threads/470006/c-graphics-problem

Member Avatar for ALEXANDER R
0
274
Member Avatar for Transcendent

` strVec.push_back(getline(about));` In that line of code, what is the variable `about`? It does not exist.

Member Avatar for Lerner
0
292
Member Avatar for umesh_1

Have you tried reading some books and writing some programs? That often helps.

Member Avatar for shayan_doust
0
173
Member Avatar for twtw

Is there an error message? Does it compile? Does it crash? Does it not do what you think it does?

Member Avatar for Taywin
0
170
Member Avatar for agrbinoo.albaker

Line 12 makes no sense. vector::size() is how to ask a vector what size it is. It is *not* how to set the size of a vector. Line 16 serves no purpose. Your internal vector object will be destructed without you having to do anything. Your setElement function changes the …

Member Avatar for Moschops
0
131
Member Avatar for nitin1

The page table has 2^20 entries. Each entry takes 4 bytes. So the page table is 4\*(2^20) bytes in total. You can write 2^12 bytes on a page. So how many pages do you need to write out the entire page table? (size of page table) / (bytes per page) …

Member Avatar for Moschops
0
200
Member Avatar for masterinex

In your `main` function, you are using `r` and `v` as parameters to a function (line 18), but your main function does not know what `r` and `v` are. Did you mean `resistor` and `volts`?

Member Avatar for rubberman
0
651
Member Avatar for ameer.idreis

Can you copy a single file onto the computer? No installation needed, no installer to run, just a single header file?

Member Avatar for HiHe
0
290
Member Avatar for yaya1234

I see that in your setter function, there is no checking or processing; it simply sets the private variables to whatever the parameter says. In this case, there is no point in having them private; you might as well make them public variables, and then you won't need setters or …

Member Avatar for rubberman
0
189
Member Avatar for Echo89
Member Avatar for Fil_1

Without looking into if `std::string` does anything clever, I have a memory that as you add to it, it will keep expanding its capacity, but it will not give up that capacity unless specifically asked to; if you reduce the number of letters of what you're actually storing, all the …

Member Avatar for NathanOliver
0
936
Member Avatar for deepeshmathuria

You seem to be writing your code in a version of C++ from about 20 years ago. A modern compiler doesn't recognise `<iostream.h>`, and a modern compiler uses namespaces, which you're not doing. Let me guess; you're using Turbo C++ from about 1993, and you have had to force Windows …

Member Avatar for Moschops
0
202
Member Avatar for Echo89

The only way to know for sure is to profile the code and identify the hot spots. When trying to improve performace, it is very, very, very, very common for a hunch or guess to be just plain wrong. Bang out the performance profiling tools (on linux, I cannot recommend …

Member Avatar for Moschops
0
176
Member Avatar for Lilgenski16

` virtual ~Deck():` Should that be a semi-colon? m_Deck.Deal(m_House); ) Should that final `)` be a `}` ? `m_house.FlipFirstCard();` Case matters. There is more. Fix the above, see if the new errors are helpful to you.

Member Avatar for マーズ maazu
0
2K
Member Avatar for Ndriçim

Long story short, you ask your operating system to do it for you. You can ask directly by learning your operating system's API. You can ask indirectly by getting a widget toolkit; you ask the toolkit, and the toolkit asks the operating system for you. As a very strong general …

Member Avatar for Moschops
0
197
Member Avatar for cypherscouter13

Undefined reference means that the linker cannot find the compiled code for those functions. Where did you write those functions? Presumably in some \*.cpp file. Either those functions do not exist (wrote declarations, didn't write the actual functions), or you haven't compiled the file containing them, or your linker has …

Member Avatar for cypherscouter13
0
1K
Member Avatar for Engr Ali

That's already C++. You could improve it by removing the `struct` keywords, passing references instead of pointers, not using `mh` and `tym` (ugly global variables), making your `particle` and `machine` types use proper C++ containers (which know their own size) instead of arrays, and using a modern C++11 random number …

Member Avatar for Moschops
0
215
Member Avatar for poketad

` for (;;)` This will loop until you `break;` from it. So `break;` at the top level of the loop (i.e. not from within something else inside the for loop) where you want to stop looping.

Member Avatar for Maritimo
0
190
Member Avatar for royalboy
Member Avatar for marina_ch

`char choice = 'a'; 'p'; 's'; 'q';` Let's take a look at this line. It creates a `char`, named `choice`, and then gives it the value `a`. All the rest of the line does nothing. It's jsut you saying letters. 'p'; does nothing,` 's';` does nothing, `'q';` does nothing. I …

Member Avatar for marina_ch
0
1K
Member Avatar for rayhaneh

Given two characters (a-z, A-Z) in the ASCII character set, setting the sixth bit high will make it lower case if it was upper case, and do nothing if it was already lower case. Here's an example with "A". 32 = 0b0100000 A = 0b1000001 32|A = 0b1100001 = "a" …

Member Avatar for rayhaneh
0
276
Member Avatar for andruluchko

` Curricuum(char *new_name, int *new_year, int new_count)` The second paramter here is an int-pointer. Not an int. ` Curricuum c1("Andriy Luchko", 1996, 0);` Here, you are trying to call the constructor using an int as the second parameter. The constructor is expecting an int-pointer.

Member Avatar for Moschops
0
188
Member Avatar for PornimaKolte

By looking at the algorithm and reasoning about the effect changing the variable workload has on the time taken.

Member Avatar for necrovore
0
92
Member Avatar for MasterHacker110

Your `ackermann` function is recursive (I don't know if it's correct, just that it's recursive), and calls itself so many times that you run out of memory on the stack. The solution is to come up with a way to make it a lot less recursive, or increase the stack …

Member Avatar for Moschops
0
268

The End.