49,761 Topics

Member Avatar for
Member Avatar for timb89

[code] int log2(int n) { int count = 1; while(!n >= 1) { if (n%2 == 0) { count++; n=n/2; } else { count++; n=n/2; floor(n); } } return count; } [/code] not sure why it isnt working?

Member Avatar for timb89
0
121
Member Avatar for Insomniac119

Everything work except for the fact that it cannot solve the whole puzzle, only a few rows. If somebody could just look over the recursive backtracking part of the algorithm, that would be greatly appreciated. Here's the snippet of code that I think is causing me grief: [code] /* @member …

Member Avatar for tux4life
0
1K
Member Avatar for vicky_menonsky

I am trying to write in a file using VC++. my program is to read the entries from the listview and write them in a text file. however i am unable to give newline after each column in listview is written , thus entire listview contents get written in a …

Member Avatar for tux4life
0
85
Member Avatar for dekaya

once I have assigned a file name to a stream object, and no longer have direct access to that file name but I do have access to the stream object is there a way to extract the file name from it? It has to know it because subsequent operations read/write …

Member Avatar for dekaya
0
2K
Member Avatar for coder101

Hi all. I'm a novice with C++ and I'd like to make a program that will present the user with a series of exam questions, most of which are numbers but some of which are descriptions. I want each question to repeat until the user enters the correct response (but …

Member Avatar for WaltP
0
164
Member Avatar for joozi

Im doing a c++ course at uni and one of my questions is to read in an external file, input a number (like 64) then the program will search the file for the number and output how many times the number the user input comes up in the file. here …

Member Avatar for WaltP
0
101
Member Avatar for 0o0

Hello, I'm new to gui programming althou i've done things before in c++ i've always encountered this error and never really tried to fix it. Lets for say I have a counter label and a button that says "Start" when one clicks start the label changes values from 0 to …

Member Avatar for 0o0
0
204
Member Avatar for sautap4u

I AM FACING PROBLEMS WITH SEPARATING SENTENCES FROM A TEXT . FOR eg. if i separate sentence after each '.' then it won't help for Dr.xyz. it would consider them as two different sentences.. but it is not. please help if possible with a suitable code..

Member Avatar for Ancient Dragon
0
265
Member Avatar for student_x

given a queue: queue<int> myqueue; write a function to remove the last entry in the queue. remark: you can't use stack, pointers, or linked list to do that. You can only use functions such as myqueue.pop(), myqueue.front() etc... Anyone has any ideas?

Member Avatar for student_x
0
6K
Member Avatar for saltysnack

Right now im making a converting program for myself. I got it to convert correctly but it only converts one character so here is my code [CODE]map<string,string>datamap; datamap["A#"]="b"; datamap["C"]="DD"; string change; getline(cin,change); for(int i=0; i<change.size(); i++) { //output based on what character gets passed to the map cout << datamap[string(change.begin() …

Member Avatar for GDICommander
0
102
Member Avatar for Argo54325

Hello i have a problem with lineing up each column up correctly, the directories seems to be all messed up. Bellow is my code, a screen shot of the problem is attached to this post. [CODE=C++]if(lSwitch == true) { cout << "\nd: " << setw(15) << right << "" << …

Member Avatar for GDICommander
0
97
Member Avatar for Tigran

Hello, A few days ago I visited a lecture of a teacher in an university that was about parallel processing. He explained why it's good etc, and how you can make programs that use multiple cpus in C. He used MPI and the code looked nice, wasn't too hard and …

Member Avatar for tux4life
0
91
Member Avatar for seao111

Hi, i am trying to make a general compression algorithm in c++ but i haven't really gotten the i/o part of this right yet. What i want to do somewhere along the line is to have my program parse say 10 or so characters at a time from a binary …

Member Avatar for seao111
0
161
Member Avatar for Helgso

This program is "C:\test\program.exe": [code]#include <iostream> #include <fstream> using namespace std; int main() { int choice; cout<<" Which name to embrace?\n\n"; cout<<" - 1. Fight Club\n"; cout<<" - 2. Shawshank Redemption\n"; cout<<" - 3. Italian Job\n"; cin>> choice; }[/code] There's also a .txt file there named file.txt, "C:\test\file.txt\". Inside this …

Member Avatar for tux4life
0
214
Member Avatar for phouse512

Hello, I'm learning to start to program in C++, and I have a problem with the prompt closing before the program ends. I know there's a lot of info about it, and I've googled it and searched here, but all the solutions to system("pause") don't work for me. I'm using …

Member Avatar for phouse512
0
103
Member Avatar for mimis

Hello, I have seen many problems that inputs an unknown size of tests and i have to output the result of each test. An example is here: [QUOTE] The Input The input will consist of a series of pairs of integers i and j, one pair of integers per line. …

Member Avatar for mimis
0
182
Member Avatar for edb500

Ok i have a parent class called MobileAccount, it has a public method called void PrintAccountInfo(), and within this PrintAccountInfo() method I call a private method called void PrintAccountType(). Now as I mentioned the parent class called MobileAccount has a subclass called AdvancedAccount, it too has a method called PrintAccountInfo() …

Member Avatar for ArkM
0
78
Member Avatar for senaddor

Hello. I am having hard time understanding recussion in binary search tree. Assuming we have 6,4,7 in our tree the following inorder function should print 4,6,7 and I don't understand how it's done. Can somebody help explaining in more detail. Thank You. [code=cplusplus] void BinarySearchTree::print_inorder() { inorder(root); } void BinarySearchTree::inorder(tree_node* …

Member Avatar for Narue
0
176
Member Avatar for rafkay

Hi Guys, this is searching coding. I needs to ;- - read data from file - DONE - bubble sort - DONE - to find the data (searching) - [B]undone.[/B] can anyone help me to find the error in my coding.. coz when i run my program, my algorithm [B]void …

Member Avatar for tux4life
0
94
Member Avatar for lauren316

Can anyone tell me what I am doing wrong in this code? The output window allows me to input the string, but does not output whether or not it is a palindrom. There are no build errors Thanks in advance! Lauren [code] #include <iostream> #include <deque> #include <string> #include <cctype> …

Member Avatar for rahul8590
0
690
Member Avatar for Argo54325

Ok I need some fast help with this, I'm trying to get a regular expression to work with my file system. this is what i currently have, but it seem to crash on, boost::regex expr(regex); [code=c++]void show_files (const path & directory, bool recurse_into_subdirs, bool lSwitch, bool rSwitch, bool aSwitch, string …

Member Avatar for Argo54325
0
185
Member Avatar for Beevee

Hi, Just a quick simple question, I have done some googleing and have been unable to find a conclusive answer, But is it possible to use the XAudio2 API (DirectX) to capture sound as well as play sound? I am planning a project where I need to play and capture …

0
38
Member Avatar for monocog

Nucleon was nice enough to provide me with the following code to help learn lists a while back. I've had a little more time to revisit lists again and would like to see what this code looks like using a linked list instead of an array.. This is NOT homework, …

Member Avatar for Lerner
0
94
Member Avatar for rahul8590

Well i just want to find out , that is there any way where we can find out the various functions and operators / keywords present in a particular header file ....?

Member Avatar for rahul8590
0
119
Member Avatar for beddy085
Member Avatar for amirshami

hullo am sory but i have some thing trigaring my mind can you please help me out find the solution for this 1write a function 2write aprogram "to readstudent's name ,examinationscore for 4 subjects ,compute their average score" please help me out with that using c++ thanks AMIRSHAMI

Member Avatar for V.V.Raman
0
125
Member Avatar for everard

I've created a program that will parse the log file generated by an MFP (Multi-Functional Printer). The program works fine when I parse a log file with less than 2000 lines, but when it reached more than 2000 lines (I've tried the log files with 8000 and 22000 lines), the …

Member Avatar for tux4life
0
93
Member Avatar for songweaver

Hey guys, this function is for rounding 2 decimal places, e.g. 1.2785 rounds to 1.2800. First, how would I alter the function so it would round 3 decimal places 1.2780, and second how would I truncate it so it would read 1.278. Thanks! [CODE]double roundIt(double x, double n) //Write definition …

Member Avatar for songweaver
0
1K
Member Avatar for vicky_menonsky

[B]iSel = ListView_GetSelectionMark(g_hwndLV);[/B] //used to get cursor selection from list view &then we write it to file //i hav problems moving the slection to next item .currently am using follg code: index=ListView_GetNextItem(g_hwndLV,-1,LVNI_BELOW); iSel=ListView_SetSelectionMark(g_hwndLV,index); //and then i write code to write next selected entry into file .code compiles.but doesnt work as …

0
42
Member Avatar for crioto

Everybody hi! Last few days i was interested in one question: Does wxWidgets working well in KDE? Windows? [I]I know[/I], that i can read official wxWidgets site for posted issues, but actually i want to know your opinion about it! I looking for good UI for my apps, and i …

Member Avatar for NicAx64
0
108

The End.