49,766 Topics
![]() | |
Hello guys. I'm stuck at my algorithm assignment. Here is the problem. We found that the solution to the mergesort recurrence f(n) = f(┏n/2┓) + f(└n/2┘) + n, f(1) = 0 satisfied f(n) = Θ(nlogn). Find an expression for the exact value of f(n). (Hint: generate the first 20 to … | |
Hey Im tryin to make a simple project which is pretty simple, but I cant seem to get it right :P Anyways, it goes like this. I have the main file which creates the window and stuff. And then I have an other file which populates the main file with … | |
I was told that I could compact this code in 2 ways. I can't use loops. Can anyone see it? #include <iostream> #include <string> using namespace std; void daysOfChristmas (int days, char switcher, string b[12]){ (days > 0 && switcher == 'y') ? daysOfChristmas(days - 1, 'y', b): false; (days … | |
Okay so I wont to output text onto my win32 program. I read somewhere that TextOut() is the function i need but it is not as good as DrawText(); Ive been trying to use DrawText() but i get stuck at the 4 parameter asking for a RECT. Any help ? … | |
I don't know what it means: [CODE] class Tree{ friend ostream& operator<<(ostream&, const Tree&); private: TreeNode *Root; void insert(TreeNode*&,int); void PrintInOrder(TreeNode*); int Median(int[],int&); public: Tree(); Tree(int); void insa(int[]); void ins(int); void print(); }; ostream& operator<<(ostream& out, const Tree& tree){ out << tree.Root ->GiveValue(tree.Root); return out; } Tree::Tree (){ Root = … | |
Im inputting from a file to a 2d array and i dont know how to stop it once it gets to the end of the file the code i have for it so far is [CODE] for(int i=0; i<records; i++) { for(int j=0; j<month; j++) { inFile >> monthArray[i][j]; } … | |
I have to write a code to build an array like this: 1,6 1,0 2,3 3,4 5,6 4,5 7,6 1,2 9,7 Where the numbers are coordinates which have to be "separated" when taken in consideration Like: cell[2][2]---> x=5 y=6 I decided to make a char array, so that with atoi() … | |
Your task is to write a main program which asks the user for an error value and then calls a function CalculatePi (error) which returns an approximate value of π. The function CalculatePi should use a loop to calculate the above series (*). It should keep two values, currentApproximation and … | |
[url]http://i54.tinypic.com/4zymi0.jpg[/url] can someone please explain how does the sizeof() and the mask help me on converting from dec to binary? and also bit shift? this what i got now: i followed the book says to bit-wise & the mask and my input; but the mask is ending with 0s(0x80000). isnt … | |
Im new to c++ and this is our first assignment. I dont even know where to start. Help! Your task is to write a main program which asks the user for an error value and then calls a function CalculatePi (error) which returns an approximate value of π. The function … | |
how can i use a string in a switch statement? | |
What is the difference between using system("pause") and cin.get(pause)? [URL="http://www.daniweb.com/forums/post1446085.html#post1446085"]Oliver [/URL]told me never use system("pause"). [code] #include<string> #include<iostream> int main(){ using namespace std; string str = "My name is shridhar"; cout<<"What is your name"<<str; char pause = 0; cout << "Press enter to continue..."; cin.get(pause); } [/code] | |
/*I have to write code for the Game of Life. I wrote nearly all the code for it but for some reason when I run my second generation it just displays the same one as before. Here is my code any idea on why this is happening would be greatly … | |
With witch header do you use this function ? I tried winsock2.h, ws2tcpip.h with no luck. Any help please ? | |
Hi everyone, I am working on a 3D viewer using libQGLViewer. In all of the examples provided, the main function looks something like this: [CODE] int main(int argc, char** argv){ QApplication application(argc, argv); Viewer viewer; #if QT_VERSION < 0x040000 application.setMainWidget(&viewer); #else viewer.setWindowTitle("pointCloud"); #endif viewer.show(); return(g_qApplication.exec()); //waits for Esc } [/CODE] … | |
Hi Everyone, Im using visual studio 2010 windows form application. I created a windows form application to add and remove files to a directory on the click of the button1. The problem is that when I put it on a different computer, it can never find those files.. Its supposed … | |
Hi Folks, This quandary should be fairly straight forward but I have yet to find an example that works. Essentially I have a struct, I create an array of these structs in C#, pass the array to C++, do some manipulation on the C++ side and return the results to … | |
I have this code : [CODE]void __fastcall TForm1::DrawGrid1SelectCell(TObject *Sender, int ACol, int ARow, bool &CanSelect) { int temp,tempR=0, tempC=0, r=0, c=0; bool empty = false; CanSelect = false; //checking for empty cell - up if (ARow > 0){ if (MyArray [ARow-1][ACol]==11){ tempR = ARow-1; tempC = ACol; empty = true; … | |
[CODE]if (progressBar1->Value == 2000; { label1->Text = "Hello"; }[/CODE] | |
well am using the turbo c++ compiler , so you must convert it to cpp ( c++) before u can use it ok. here we go. steps: (1)press the windows shortcut key and hold R or go click on RUN (2) type in the following( C:/TC/BIN/TC.EXE) hit ENTER, wait for … | |
Sup guys, I got another "little" thing here , i am trying to create a preprocessor macros for SQL language , so when the compiler run into things like SQL key words : for example : COLUMN(title) TYPE(string), COLUMN(author) TYPE(string), COLUMN(copies) TYPE(int), it automatically will generate appropriate C++ code ( … | |
i dunno whether this question has been ask before but i've try to search but didn't found. so i ask it here... very simple... if i declare [B]int Z; cin >> Z;[/b] if I enter integer, it works fine but i enter character it's looping. :sad: how to prevent it … | |
Hello i need help with writing a small pseudo code for my subject Programming methods i could not attend classes because i was hit by floods and my deadline is in 3 days please email me at[I] <<snip>>[/I] if u can help Any help is appreciated Thanks | |
Hi everyone! Just wanted to ask before i begin messing around. Is it possible for two processes to access the parallel port simultaneously? So that if i short circuit Input pins to output pins of the parallel port one process will provide input to another one? I am using Windows … | |
i am trying to move the node in the first item from the list and add it to the back of the list 1->2->3 becames 2->3->1 instead i get 3 1 2 [CODE] #include <iostream> using namespace std; struct nodeType { int info; nodeType *link; }; void createList(nodeType*& first, nodeType*& … | |
First of all, I'm new to Daniweb and I would like to thank in advance to all those who take their precious time to help me. I appreciate it greatly. Hopefully, I'll get good enough to contribute and help others in the Daniweb developing community, as well. The problem I'm … | |
I need help to create C++ program for this question Input the price of a product and the tax code (R or L).If the code is ‘R’ the tax rate is 8% and the rate is 12% for ‘L’. Calculate the total price and tax paid for the product. Continue … | |
[ICODE]#include<iostream> #include<conio.h> #define height 10 using std::cout; using std::cin; using std::endl; int main () { //int num=0; int n,m,width; int count = 0; int nums[count]; int div=0; cout<<"Enter the number you wish to enter: "; cin>>width; int jologs [height][width]; cout<<endl<<width<<endl; for (int i=0, m=width; i < width; m--,i++) { cout<<endl<<endl<<"Number(s) … | |
I'm making a program and in one of the part of the program there is this button and for it to do main function it needs to check if the notepad is running. So how can i check if the process is running? | |
Greetings Friends: I am stuck with a compilation error that I have not been able to resolve. I was able to duplicate this error with a test program so whatever I am doing (or not doing), it is the same. Please see the code below. The error is actually from … |
The End.