c++

Creating X Number of Nameless Objects

Hello, In a lot online judge problems, the format for the input is as follows: first line is the number of test cases. Let's say X. Then X lines after that are the conditions for each test case. In the example below, there are two test cases. Each test case specify the upper and lower bound for which primes should be shown in the outpu...

Reading data from file created from outside

I'm trying to read from files created outside of the program, but am having some trouble. The program has the user create a file. Then it reads words from two .txt files created outside of the program, and then writes the words to the created file. #include "std_lib_facilities.h" int main() { string word; cout << "Create file....

Connect to a wireless network programmatically

I'm trying to write an application that connects to my company's wireless network automatically on windows XP. I've found the Wireless LAN API but it requires me to have some hotfix installed on the machine, and you need to have sp2 or higher(There are machines with SP1, and I'm required to support any XP machine). I've tried to find s...

Best way to rotate an image using SDL?

I am building a game and the main character's arm will be following the mouse cursor, so it will be rotating quite frequently. What would be the best way to rotate it? ...

Visual Studio C++ 2008 linking question

Hi, My project has a bunch a solutions containing several projects. There're 2 Configurations: Release (/MT) Debug (/MTd) We have a 3rd party library. Should we have 2 version of it for each Configuration (Release version compiled with /MT and Debug version compiled with /MTd) or it's enough to have one version (/MT or /MTd)? Tha...

Using getline(cin, ...) after using cin>>...

The code below has a method that sets the member field 'x' using the getline() function. I noticed that if I use cin before calling that method, my program would hang the next time I reach the line getline(cin, rangeInput). Since getline() is using cin, is that why it is causing the program to hang if I have previously used cin? What sh...

Graduation Project

I require to do a project as a part of my final year of engineering graduation studies.Can you suggest some projects pertaining to distributed systems and artificial intelligence together and which require python,c or c++ for programming? Note:-Please suggest a project that is attainable for a group of 2 students. ...

How to incoparate or implement a DOM API to v8?

I am writing a server application that is able to manipulate the DOM before it is served to the client. I am using C++ and Google's v8 as a javascript engine but I don't see any DOM API in v8. Is there an open source implementation for doing DOM manipulation on HTML? If not how would you implement one? ...

Implementing comparison using a generic interface in C++

Let's say I'm working on a library that works on items of type Item. The main entry point is a class like: class Worker { private: SomeContainer _c; public: void add( const Item &i ); void doSomething(); }; The doSomething() method looks at the added items, compares them, etc. and does something with them. So the Item class ...

Execute a process and return its standard output in VC++

What's the easiest way to execute a process, wait for it to finish, and then return its standard output as a string? Kinda like backtics in Perl. Not looking for a cross platform thing. I just need the quickest solution for VC++. Any ideas? ...

light weight HTML Parser for translating to formatted text?

I'm finding light weight HTML Parser for translating to formatted text. for example: <html> <body> <a href="http://www.google.com/"&gt;Google&lt;/a&gt; <img src="http://images.google.com/intl/en_us/images/logos/images_logo.gif" alt="Google image logo" /> <ol> <li>first</li> <li>second</li> </ol> <ul> <li>apple</li> <li>orange</li> </ul>...

How to correctly configure netbeans 6.7 and c++ on windows?

Hello. I have installed and configured NetBeans 6.7 for c++ according to the official manual: http://www.netbeans.org/community/releases/67/cpp-setup-instructions.html#mingw Configuration window looks like this: Unfortunately, at 'compile' command following line is displayed: /usr/bin/make -f nbproject/Makefile-Debug.mk SUBPROJECTS=...

rtf / doc / docx text extraction in program written in c++/qt

I am writing some program in qt/c++, and i need to read text from ms word/rtf/docx files . And i am looking for some cmd program that can make that extraction . It may be several progs. the closest thing i found is http://silvercoders.com/index.php?page=DocToText but it has several bugs so i cant use it . I have also ms word installed on...

DLLs and STLs and static data (oh my!)

OK..... I've done all the reading on related questions, and a few MSDN articles, and about a day's worth of googling. What's the current "state of the art" answer to this question: I'm using VS 2008, C++ unmanaged code. I have a solution file with quite a few DLLs and quite a few EXEs. As long as I completely control the build enviro...

Memory barriers in userspace? (Linux, x86-64)

It is easy to set memory barriers on the kernel side: the macros mb, wmb, rmb, etc. are always in place thanks to the Linux kernel headers. How to accomplish this on the user side? ...

Is there a way to access the underlying container of STL container adaptors ?

Is there a standard way to access the underlying container of stack, queue, priority_queue ? I found a method called : _Get_container() in VS2008 implementation of stack and queue, but no one for priority_queue! I think it is not standard anyway. Also, I know it is a silly question! where can I find official documentation of the standa...

Should we be teaching beginners to use a global namespace?

NOTE: I am pretty much a beginner myself. This question concentrates on C++ usage, since that is the only language I have experience with. There seems to be a consensus on Stack Overflow to use using namespace std; in the code examples provided for C++. I originally learned it this way, and was never taught WHY this is a problem later o...

Reading parts of a line (getline())

Basically this program searches a .txt file for a word and if it finds it, it prints the line and the line number. Here is what I have so far. Code: #include "std_lib_facilities.h" int main() { string findword; cout << "Enter word to search for.\n"; cin >> findword; char filename[20]; cout << "Enter file to search...

Generating a 3D GUI through CGI

Hello, I'm implementing a web application that is written in C++ using CGI. Is it possible to use a 3D drawn GUI that also has animations? Should I just include some kind of mechanism that generates animated gifs and uses an image map? Is there another, more elegant way of doing this? EDIT: So it sums up to Java or Silverlight or Flash ...

working with string arrays in c++

I wanna create a list of 50 elements which consist of four chars each. Every four char string should go into a loop one by one and get checked for one of three letters (o, a, e) anywhere in the current string. dependent on whether or not these letters are identified different commands are executed I tried all day im frustrated please he...