159 Posted Topics

Member Avatar for Kanoisa

Yes, that should be an appropriate solution. The task says that the setw argument shouldn't need to be changed manually when i grows - and your solution does just that.

Member Avatar for arkoenig
1
183
Member Avatar for PixelExchange

You can get all window titles by using the WinAPI function [url=http://msdn.microsoft.com/en-us/library/ms633497%28VS.85%29.aspx]EnumWindows[/url]. To get the active window, you can use GetForegroundWindow. But like all cheat protections, it can be easily bypassed. What if I just don't create a window for my cheat program and instead operate the chess program directly? …

Member Avatar for PixelExchange
0
109
Member Avatar for Nulled

You need to link the C++ library statically. How to do that depends on your compiler, Google will help you there. I'm assuming VC++, since MinGW automatically links it statically.

Member Avatar for Aranarth
0
92
Member Avatar for xan517

You're going to have to describe in detail what you're [i]really[/i] trying to do.

Member Avatar for xan517
0
36
Member Avatar for Auraomega

You shouldn't use malloc at all. This is how you do it properly: [CODE]s_cell** cell=new s_cell*[MAP_X]; for (int x=0;x<MAP_X;x++)cell[x]=new s_cell[MAP_Y];[/CODE] Even better is the following: [CODE]vector<vector<s_cell> > cell(MAP_X,vector<s_cell>(MAP_Y));[/CODE]

Member Avatar for Aranarth
0
168
Member Avatar for empror9

See here: [url]http://www.cplusplus.com/forum/beginner/26566/#msg141819[/url]

Member Avatar for mike_2000_17
0
5K
Member Avatar for ichigo_cool

When seeding a pseudo random number generator with a certain number (that's what srand does), it will always produce the same series of "random" numbers. So you should call srand just [i]once[/i] at the beginning of the program.

Member Avatar for mrnutty
0
240
Member Avatar for RStartin

First: drop Dev-C++. Not only is the IDE itself outdated, but the version of MinGW that comes with it also is. Make sure to do a clean uninstall that also gets rid of MinGW, then install Code::Blocks. As to your problem, store pointers if your objects are [i]very[/i] expensive to …

Member Avatar for RStartin
0
386
Member Avatar for ichigo_cool
Member Avatar for ichigo_cool
0
104
Member Avatar for smoothe19

To split the string, you can use [url=http://www.boost.org/doc/libs/1_43_0/doc/html/string_algo/usage.html#id1761650]boost::split[/url] or stringstreams. For hash tables, see [url=http://www.boost.org/doc/libs/1_43_0/doc/html/unordered.html]boost::unordered_set[/url].

Member Avatar for Andreas5
0
138
Member Avatar for Lusiphur

I do: [url]http://www.boost.org/doc/libs/1_43_0/[/url] boost is essentially an inofficial extension to the C++ standard library and contains many things that were not included in the standard library, but that you will need sooner or later in your programs.

Member Avatar for mike_2000_17
0
372
Member Avatar for eng.M

It inserts the value key at position index into the array a which currently has n used elements. The if statement checks whether the index is out of bounds and does nothing if it is and also does nothing if it isn't.

Member Avatar for eng.M
-1
94
Member Avatar for khaled mohamed1

Either move all other patients down one position or make an array of pointers to patients and allocate them dynamically. Then you can delete the patient at a certain position and mark the position as free by setting the pointer to 0. Since your array seems to play a double …

Member Avatar for Aranarth
0
117
Member Avatar for mrnutty

A top-down solution, although not much different: [CODE]#include <iostream> #include <fstream> #include <vector> using namespace std; int clamp(int val,int max) { if (val<0)return 0; if (val>max)return max; return val; } int main() { ifstream file("triangle.txt"); vector<vector<int> > triangle; while (file.good()) { triangle.push_back(vector<int>(triangle.size()+1)); for (int i=0;i<triangle.back().size();i++)file >> triangle.back()[i]; } for (int …

Member Avatar for iamthwee
0
138
Member Avatar for neil_mahaseth

@tajendra Note that the coin counting must work for arbitrary coin ranges, not just the entire range. Also, you need to reduce nFalseCoinCount when appropriate. If vijayan121's solution is not fast enough (you're already compiling with -O3, right?), you can implement vector<bool>'s shifting logic yourself and then flip 32/64/128 coins …

Member Avatar for neil_mahaseth
0
144
Member Avatar for crapgarden

There is a predefined operator "ranking" which determines the order operators are evaluated in: [url]http://www.cppreference.com/wiki/operator_precedence[/url] It's basically just like in maths, e.g. products and fractions are evaluated before sums. To change that order, you can use brackets. In your above example, the brackets are superfluous. This will have the same …

Member Avatar for crapgarden
0
129
Member Avatar for amiref

Those are references. They're basically like self-dereferencing pointers. I suggest looking them up in your C++ book.

Member Avatar for Aranarth
0
73
Member Avatar for insanely_sane

I'd recommend SFML if you don't need a GUI. Using SFML is child's play and they have many code examples.

Member Avatar for ramox
0
335
Member Avatar for aldrin12

Since the code posted contains a total of ten mistakes and is also meant for a rectangle, the OP will still need to show some initiative of his own.

Member Avatar for Stefano Mtangoo
0
201
Member Avatar for Kanoisa
Member Avatar for Kanoisa
0
1K
Member Avatar for cmutzel02
Member Avatar for cmutzel02
0
271
Member Avatar for XxPKMNxX

Is the declaration of ignition inside the loop? Then you shouldn't be surprised, you're recreating it and initializing it to false each time. [QUOTE]declaring ignition as true[/QUOTE] That's an assignment, not a declaration. The declaration is bool ignition; [QUOTE]Im new to the C[/QUOTE] Looks like C++ code to me. [QUOTE](ignition …

Member Avatar for mrnutty
0
112
Member Avatar for Sarkahn

You're pushing char pointers into the vector that become invalid when temp is changed. You need to make a vector of strings or you need allocate memory for each char array and copy the string into it.

Member Avatar for Sarkahn
0
1K
Member Avatar for rayborn66

This would be so much easier if you just used strings, see the code example below. It would also help if you would just open your C++ book and start reading... it doesn't look like you've done that until now. This code still doesn't handle punctuation marks properly like the …

Member Avatar for Aranarth
0
778
Member Avatar for Member 784453

Because you aren't calling the functions, you're just declaring them. Get rid of the int to turn them into calls. You should also look up function parameters. You should pass x, y and z as parameters to the functions instead of making them global variables.

Member Avatar for Member 784453
0
163
Member Avatar for maira74

There are so many errors in your code that it's pointless to even start pointing them out. Why don't you just read the first few pages in your C++ book? They should tell you all you need to know to fulfill the task.

Member Avatar for NP-complete
0
238
Member Avatar for ChaseRLewis

Or [CODE] std::string reversestring(test.rbegin(),test.rend()); std::cout << reversestring;[/CODE] for that matter.

Member Avatar for ChaseRLewis
0
169
Member Avatar for p@rse

It sounds like you might be interested in Project Euler: [url]http://projecteuler.net/[/url] It provides many problems for which you'll have to come up with different algorithms in order to solve them.

Member Avatar for Aranarth
0
70
Member Avatar for Member 784712

You cannot create an OS in C and C++ alone, since it provides no way to talk with the hardware. This should get you started: [url]http://wiki.osdev.org/Main_Page[/url]

Member Avatar for Aranarth
0
109
Member Avatar for sisterjo
Member Avatar for Kanoisa
0
188
Member Avatar for YoavX

[QUOTE=YoavX;1266626]it gets CPU overflowed weirdly[/QUOTE] ...what? You should really post an accurate error description in the future. As to your problem (or one of them), you're trying to free buffer even though you allocated it on the stack. So that inevitably leads to stack corruption.

Member Avatar for Aranarth
0
141
Member Avatar for arbme

Assuming you're using Windows, you should search for "winapi recv hooking" and "winapi detours".

Member Avatar for Aranarth
0
107
Member Avatar for gameon

You seriously need to learn how to use Google and MSDN. Here: FindFirstFile: [url]http://msdn.microsoft.com/en-us/library/aa364418%28VS.85%29.aspx[/url] FindNextFile: [url]http://msdn.microsoft.com/en-us/library/aa364428%28v=VS.85%29.aspx[/url] WIN32_FIND_DATA: [url]http://msdn.microsoft.com/en-us/library/aa365740%28v=VS.85%29.aspx[/url] More examples: [url]http://www.google.de/search?source=ig&hl=de&rlz=&=&q=findfirstfile+example&aq=0&aqi=g1&aql=&oq=findfirstfile+e&gs_rfai=[/url]

Member Avatar for gameon
0
1K
Member Avatar for dansnyderECE

If you store all your lines in a list, you can use a map that maps the number in front of each line to its iterator in the list. That way you can both find the line in question very quickly and any line insertions will be very cheap.

Member Avatar for Aranarth
0
98
Member Avatar for bgreer5050
Member Avatar for mattloto

Windows also knows the concept of pipes (see CreatePipe on MSDN), although throughput is lower than on Linux. Chances are it's still fast enough for what you're trying to do, though.

Member Avatar for mkvist
0
290
Member Avatar for achieve_goals
Member Avatar for daviddoria
0
72
Member Avatar for dansnyderECE

[QUOTE=;][/QUOTE] std::vector is unsuitable for this. What you are looking for is std::map.

Member Avatar for dansnyderECE
0
165
Member Avatar for riu
Member Avatar for oz_engineer
0
230
Member Avatar for dansnyderECE

Depends on whether the strings in the array are null-terminated. If so, you can just construct the string using the (casted) starting address. If not, there's a constructor that takes a range. When each int element only contains a single character, you'll have to convert the desired subarray first.

Member Avatar for dansnyderECE
0
129
Member Avatar for anshuli30

How about explaining what you're trying to do exactly? A web crawler and a program to searcb your hard disk are two different things.

Member Avatar for anshuli30
0
75
Member Avatar for XAaronX

If you want to append data to the file, open it with ios::app: [code]ofstream fout("bitmaps.txt",ios::app);[/code] Can't really say anything about your code structure without having seen the code, but it's generally good to have short functions that fulfill a clearly defined task.

Member Avatar for XAaronX
0
85
Member Avatar for genux

The size of the allocated chunk of memory is usually stored somewhere, but that is not required and completely depends on the implementation. Imagine a specialized memory management that exclusively sets aside a few pages of memory for allocations of exactly 4 bytes. In that case the size doesn't need …

Member Avatar for genux
0
94
Member Avatar for Jennifer84

There code itself seems okay, besides that it is poorly formatted. You need to use arrays here. If I'm guessing right, this will shrink down the code to less than 10 pages and won't give the compiler trouble anymore.

Member Avatar for Jennifer84
0
652
Member Avatar for Wakesta

If you need a compiler and an IDE, see here (make sure to get codeblocks-10.05mingw-setup.exe): [url]http://www.codeblocks.org/downloads/26[/url] Free online book: [url]http://www.mindview.net/Books/TICPP/ThinkingInCPP2e.html[/url]

Member Avatar for ctaylo21
0
97
Member Avatar for j-green.10

Check the string reference: [url]http://www.cplusplus.com/reference/string/string/substr/[/url] The second parameter is the desired [i]length[/i] of the substring, not the position of the last char.

Member Avatar for Nick Evan
0
130
Member Avatar for Excizted

Make sure [i]all[/i] object files were compiled with -fPIC by doing a full rebuild of the shared library. See here as well: [url]http://www.gentoo.org/proj/en/base/amd64/howtos/index.xml?part=1&chap=3[/url]

Member Avatar for tarakant_sethy
0
155
Member Avatar for beginnercoder

[QUOTE]After entering n, the program just keeps asking for n, and does not procede. I am at a block and really not sure what is going on. I think I almost have this done![/QUOTE] I don't get... how did you run a non-compilable program?

Member Avatar for JIMITRIS
0
90
Member Avatar for Orion2k
Member Avatar for IS_student

Are you trying to win an obfuscated code contest or something? I'm usually not a friend of unnecessary whitespace, but this is overdoing it. A readable version after sending it through a formatter: [CODE]#include <iostream> using namespace std; int main() { double** marks2d; double stud_row=4,Quiz_Col=6; double sumup=0; double* avg=new double[stud_row]; …

Member Avatar for finito
0
109

The End.