344 Posted Topics

Member Avatar for firebird102085

You've almost got it right. Note that it should be `int main()` and pausing at line 35 achieves nothing. Here's your code with some corrections. #include <iostream> using namespace std; int lastLargestIndex(int [], int); int main() { int arr[15] = {5,198,76,9,4,2,15,8,21,34,99,3,198,13,61,}; int location = lastLargestIndex(arr, 15); if (location != -1) …

Member Avatar for mrnutty
0
1K
Member Avatar for xNeverLetGo

Personally, I find the wording of the question somewhat ambiguous. Hopefully this will help you. #include <iostream> using namespace std; int main() { int posCount = 0; int negCount = 0; int posSum = 0; int negSum = 0; int numb; cout << "Please enter any combination of ten positive\nor …

Member Avatar for xNeverLetGo
0
1K
Member Avatar for Na'Vi

What compiler are you using? Seeing as `printf("%%%s", registers(C))` isn't working as expected, you may need to resort to a workaround like `printf("%s%s", "%", registers(C))`

Member Avatar for nullptr
0
153
Member Avatar for dewdropz

Change lines 22 and 27 to match the function prototypes in lines 10 and 11. You need to pass the correct variable name to each function. e.g. `displayArrayVal1( x_array);` The printf lines need fixing to something like: `printf("X-array1 = %u\n", x[0]);`

Member Avatar for nullptr
0
325
Member Avatar for miles.sifflet

You really should be checking the return value of ReadProcessMemory, WriteProcessMemory etc. Here's your code minus the spelling mistakes and the obvious syntax errors. I've no idea if it works, I've not completely cleaned it up, but it does compile. #include <iostream> #include <Windows.h> #include <string> #include <ctime> DWORD FindDmaAddy(int …

Member Avatar for miles.sifflet
0
410
Member Avatar for aasked

line 12 `while ( k <= 0)` This condition is only met when k = 0. line 14 `j=3;` This is out of bounds for your matrix, valid values are 0 to 2 inclusive. line 16 `Image1[i][k]= Image2[j][k];` This is the wrong way around. You're just copying memory junk from …

Member Avatar for nullptr
0
88
Member Avatar for Asmaa_2

`' '` is the space character which equals 0x20 or 32 in decimal. The rest of the code is explained here > http://www.cplusplus.com/articles/1AUq5Di1/

Member Avatar for MandrewP
0
500
Member Avatar for saurabh.mehta.33234

I'm not sure if this is what you mean, but try `printf("How are you %%dad%%");`

Member Avatar for Gonbe
0
157
Member Avatar for anukavi

If they turn off broadcasting of the SSID from the router, then only wireless connections configured with that SSID and the security passphrase (key) will 'see' the SSID. Any other wireless connection will just see something like 'Unknown network'.

Member Avatar for anukavi
0
118
Member Avatar for abdelrules

Also line 20 `else { int main() ; }` This is another function prototype, though even if you wrote: else { main(); // recursive call to main } Recursively calling main() should not be done. In function: `int area()` you may as well change it to `void area()` as you …

Member Avatar for Gonbe
0
235
Member Avatar for marnun

bool containsVowel (string s) { if (0 == s.length()) return false; if ( (s.substr(0,1)=="a") || (s.substr(0,1)=="e") || (s.substr(0,1)=="i") || (s.substr(0,1)=="o") || (s.substr(0,1)=="u") ) return true; return containsVowel (s.substr(1, s.length() - 1)); } I'll leave you to work out handling uppercase vowels.

Member Avatar for marnun
0
516
Member Avatar for new_developer

Use [std::getline](http://www.cplusplus.com/reference/string/getline/), at present when you have `cin >> name`, if the entered name is M John then only M will be read into the name, for information on why your program then terminates refer to http://www.daniweb.com/software-development/cpp/threads/90228/flushing-the-input-stream

Member Avatar for new_developer
0
178
Member Avatar for jannesb1

There's most likely some memory junk in the upper 16 bits of the ebx register, so change `mov bx,1` to `mov ebx,1`

Member Avatar for jannesb1
0
214
Member Avatar for aslam.junaid786

See the comments I added to your display function. void display() { ifstream ofile("abc.txt"); string bookname; string publisher; string author; int copies; int price; int edition; // none of this will display anything from abc.txt // as nothing from abc.txt has been read. cout<<" Book Name: "<<bookname<<endl; cout<<" Publisher Name: …

Member Avatar for aslam.junaid786
0
212
Member Avatar for pjh-10

long int - 4 bytes char/unsigned char - 1 byte float - 4 bytes double - 8 bytes The same for x64.

Member Avatar for vmanes
0
228
Member Avatar for new_developer

The simple reason for the error is that the scope in which BankAccount b1 is valid, ends with the closure of your `if (input == "y")` block. Here's your code with a few minor alterations. class BankAccount { protected: double balance; public: BankAccount() { balance = 0.0; } BankAccount(double b) …

Member Avatar for nullptr
0
131
Member Avatar for kruschev

You could also handle invalid input like this: unsigned short int x; bool flag = false; cout << "Enter an integer that I will reverse i.e. 301 --> 103" << endl; while (!flag) { cin >> x; if (cin.fail() ) { // clear error flags and flush input cin.clear(); cin.ignore(90, …

Member Avatar for nullptr
0
279
Member Avatar for pianokey09

> Not possible. Line 27 is wrong, as I explained in my last post. open() doesn't take a std::string as the first argument, it takes only char*. This was discussed in [this thread](http://www.daniweb.com/software-development/cpp/threads/442092/stdstring-as-argument-to-ifstream.open-). and is possible, though I can't vouch for every compiler accepting a std::string as the file name. …

Member Avatar for Ancient Dragon
0
156
Member Avatar for 123386761

You're variables are being filled in the scope of `main()`, so once you call `output()` those variables are no longer in scope. The 'dirty' solution would be to declare the variables as global variables. A cleaner way would be to define a struct to hold the variables, fill the struct …

Member Avatar for 123386761
0
188
Member Avatar for vikuseth

Apart from mike_2000_17 suggestions, another alternative would be to use a launcher for your application. launcher.exe which doesn't rely on the possibly missing dll, checks for the dll and if not found issues the error message and exits, otherwise it launches the main executable. You could even embed the main …

Member Avatar for rubberman
0
228
Member Avatar for pjh-10

> The second pow function has no exponent. I thought this at first, but if you look closer you'll realise that it does. On line 42. `a = sqrt(x);` What is the purpose of a and where should it be used? (line 43?)

Member Avatar for pjh-10
0
166
Member Avatar for M4ver1k

Something like this? struct person { string first; string last; string addr; string phone; }; int main () { vector<person> pvec; person tp; tp.first = "Rhino"; tp.last = "Neil"; tp.addr = "22 Acacia Avenue"; tp.phone = "5554646"; pvec.push_back(tp); tp.first = "Orson"; tp.last = "Cart"; tp.addr = "Some Place, Unknown"; tp.phone …

Member Avatar for M4ver1k
0
171
Member Avatar for marnun

Here's a fairly memory efficient example. The idea is basically to create an array where each bit in the array represents an integer. If the bit representing that integer is set then the function returns false, otherwise it sets the corresponding bit and returns true. bool add2intArray(unsigned int* iarray, int …

Member Avatar for marnun
0
267
Member Avatar for tony75
Member Avatar for rotten69
0
543
Member Avatar for Jbvo

The name strings should be "Jon" and "Bill" so I'm surprised it compiles. Without knowing anything about your classes, it's difficult to comment further.

Member Avatar for Jbvo
0
95
Member Avatar for marnun

> The function returns true if the HEAP property holds among the array elements x[i]...x[n-1] , and false otherwise. The HEAP property is simply that for every value of j between i and n-1 , x[j] is not less than its heap children **if they exist**. (The heap children of …

Member Avatar for marnun
0
240
Member Avatar for harris24

In class Tree you have a constructor defined but no implementation for it. class TREE { public: NODE * headLeaf; NODE * getmin(); void Binary(NODE *); void Create(); void Insert(unsigned char); void printTree(NODE * n); TREE(); // <-- constructor with no implementation edit: deceptikon beat me to it. :)

Member Avatar for harris24
0
350
Member Avatar for Magic681

In line 65 you've got `return main()`, that's part of the problem. You should never recursively call the entry point of a program. The do/while loop should look like: do { // calculate compchoice // cin >> choice // process data } while (winCount < 3); After that you'd display …

Member Avatar for Magic681
0
420
Member Avatar for blindislands

The major reason that your tableAverage function fails is because the average is being calculated inside the loop that iterates through the array. while (count < num) { sum += a[count]; ++count; average=sum/num; // this should not be inside the loop } You also declare `float average` when infact you …

Member Avatar for nullptr
0
135
Member Avatar for KE50

Set the PlainText property to false, then `RichEd.Lines.SaveToFile('...\blah.rtf');` or use a TMemoryStream not a TStringStream.

Member Avatar for pritaeas
0
285
Member Avatar for honey_sw816
Member Avatar for anukavi

Try calling [UpdateWindow](http://msdn.microsoft.com/en-us/library/windows/desktop/dd145167%28v=vs.85%29.aspx) after you call .put_Text("Waiting...")

Member Avatar for anukavi
0
322
Member Avatar for anukavi

You've got: memcpy(InBuffer,"KL10",4); memcpy(&InBuffer[4],"123456",6); memcpy(InBuffer[10],"0987",4); Do you see the error in line 3?

Member Avatar for anukavi
0
263
Member Avatar for starkk

`(*string <= '9' && *string >= '0')` In hexadecimal this translates to *string <= 0x39 && *string >= 0x30 `*string - '0'` Assume the number is 8, therefore *string would be in hex 0x38. So 0x38 - 0x30 = 8 You could also use: `value = (value * 10) + …

Member Avatar for nullptr
0
108
Member Avatar for manashmanash

Read this - http://www.daniweb.com/software-development/cpp/threads/78223/read-this-before-posting-a-question Then give coding the program your best effort.

Member Avatar for Lucaci Andrew
-3
211
Member Avatar for andrew mendonca

void getTopTwoScores(double scores[], int numScores, double& highest, double& secondHighest) { if (numScores == 1) { highest = secondHighest = scores[0]; // nothing else to do return; } // initialize highest and secondHighest // assume highest is scores[0] // secondHighest we'll set to negative maximum double value highest = scores[0]; secondHighest …

Member Avatar for nullptr
0
200
Member Avatar for anukavi

> I have got an integer as 0010000001 Is 0010000001 binary? If it is, just shift right the number of digits to remove. If it's just a decimal integer then num/10000 seems logical.

Member Avatar for Lucaci Andrew
0
1K
Member Avatar for Growl

`find 2 ^ k` Seeing as you can't use the pow(...) function, you could just use bit shifts. 2 << (k - 1) 2 shift left (k -1 ) will give you 2 to the power of k, where k is an unsigned whole number.

Member Avatar for NathanOliver
0
111
Member Avatar for sean.walker.3785

I really don't have the time at present to go through all your code. One thing that immediately stands out is: private: Node *attachedNodes[4]; Your code is using attachedNodes[0] .. attachedNodes[4] inclusive, which equals 5 Nodes not 4.

Member Avatar for sean.walker.3785
0
189
Member Avatar for pjh-10

I'm not sure whether this is what you're after: #include<iostream> #include <iomanip> //#include<fstream> using namespace std; int main() { int input = 1; int board[3][4]; for(int i=0; i<3; i++) //This loops on the rows. { for(int j=0; j<4; j++) //This loops on the columns { board[i][j] = input; input++; } …

Member Avatar for pjh-10
0
135
Member Avatar for ikra61893

Here's some code for your 3rd function. void aretheysame(int x, int y, int z) { if (x == y && y == z) { cout << "All numbers equal" << endl << endl; return; } if (x != y && y != z && x != z) { cout << …

Member Avatar for ikra61893
0
156
Member Avatar for Ubunterooster

You have a function declaration of `char getServiceCode (char serviceCode);` that you try to pass your char serviceCode variable to. You need to either pass the variable instance or a pointer to the variable, otherwise nothing will be assigned from the function to the serviceCode address space. Just change your …

Member Avatar for nullptr
0
178
Member Avatar for nawabzadahassan

Childish rubbish that's not worth discussing. Read the forum rules http://www.daniweb.com/community/rules

Member Avatar for nullptr
-1
145
Member Avatar for mchung90

It all looks fine to me too, just a few things to clean up: *Close the file when you're finished with it - `in.close();` *Pause execution to read the string ( cin.get() or similar) and then `return 0;`

Member Avatar for nullptr
0
322
Member Avatar for kidpro
Member Avatar for Adak
0
130
Member Avatar for ktsangop

Perhaps CreateTimerQueue, CreateTimerQueueTimer, DeleteTimerQueueTimer would do what you want. Plus it's easy to wrap them into a class. http://msdn.microsoft.com/en-us/library/windows/desktop/ms682483%28v=vs.85%29.aspx http://msdn.microsoft.com/en-us/library/windows/desktop/ms687003%28v=vs.85%29.aspx

Member Avatar for ktsangop
0
768
Member Avatar for ayesh.yousaf
Member Avatar for ymdeek

> what I should write beside return ? Use cout to inform you what max is. Pause execution before `return 0;` so that you can see the result. After that, look at ways to optimize your maxValue function.

Member Avatar for nndung179
0
229
Member Avatar for Monster99d

Initialize WNDCLASS as already suggested and after your call to ShowWindow(...), call UpdateWindow(hWnd);

Member Avatar for nullptr
0
107
Member Avatar for sarafuddin

> Can I get the question's solution? No, you won't receive any help until such time as you present code that demonstrates that you've made a genuine attempt to solve the problem.

Member Avatar for Despairy
0
178

The End.