344 Posted Topics
Re: [PhotoRec](http://www.cgsecurity.org/wiki/PhotoRec) should be able to recover any files that are still intact. | |
Re: double totalSq=0, avg =0; total += num; totalSq+= (num-avg)*(num-avg); In the second loop: Isn't the declaration of `double totalSq=0, avg =0;` only in scope for this loop? Shouldn't these values just be initialised before the loop and const removed from the initial declaration of avg - `double avg = static_cast<double>(total) … | |
Re: line 72, 73: The delimiter should be a char not a string. `','` | |
Re: Change all the `for` loops in your vCount function to be like: `for (int ii = 0; ii < vowelA; ii++) // < not <=` The same for line 65. `for (int i = 0; i < nochar; i++)` | |
Re: I'll attempt to explain this by showing each iteration of the while loop. int x = 125 loop 1: count = 1, x = (125/10) which = 12 loop 2: count = 2, x = 12/10 which = 1 loop 3: count = 3, x = 1/10 which = 0 … | |
Re: Scan your system with [MBAM](http://www.malwarebytes.org/), select Free version download. Then try running [ESET's online scanner](http://www.eset.com/us/online-scanner/). Their may be some manual cleanup needed once the infection is removed. Post back if you need further assistance and provide the scan logs. | |
Re: With your current approach, you are actually making this far more difficult than it is. There is no reason to use an array, all you need are two integer variables, one to hold the current input and the second to hold the sum. Then you continue to take integer input … | |
Re: You've already initialized count to zero, make sure you do the same for sum. I've kept the outside while loop as is to maintain your assumption that the you need to check for eof and removed the unnecessary inner loop. while ( !num_list.eof()) { num_list >> number; sum += number; … | |
Re: > find the product of all the positive even numbers less than or equal to 30 You're only calculating the product for positive even numbers less than 30. So it should be: prod = 1; n = 30; for (even = 2; even <= n; even += 2) prod *= … | |
Re: #Include<fstream> // should be #include (all lowercase) #include<> // what's this meant to be? You should also check whether your outfile is open. if (!outfile.is_open() ) { // print an error message if you like return 1; } After writing to outfile, close it: `outfile.close();` Instead of writing the entire … | |
![]() | Re: As tinstaafl indicated, the top of your header file should be: #ifndef MIXEDEXPRESSION_H // if not defined #define MIXEDEXPRESSION_H |
Re: > I have to write a fn Yes you do, so what problem are you having in writing the function? | |
Re: The problem lies in: while(count < len && inputFile >> numsRead[len]) count++; You're constantly trying to read to numsRead[8] as len = 8, which is out of bounds for the array. You need to read to `numsRead[count]` You should also check as to whether the file is successfully opened using … | |
Re: If nombres.txt is in the same directory as the compiled executable and running under the debugger goes straight to `cout<<"algo paso"<<endl` - try running the executable outside the debugger. Some suggestions for your code. If you put `cout << linea << endl` at the top of your while loop, you'll … | |
Re: Could you please post the code you have. The information you've provided so far isn't enough to do anything more than take wild guesses. | |
![]() | Re: You need to process each word (token). while (inputFile.getline(words, 100)) { // Read each word. linecount++; token = strtok(words, " .\n"); while(token != NULL) { // process each token longestandshortestWord(token, longestword, shortestword); uniquewords(token, uniqueWords, position, uniquewordcounter); token = strtok(NULL, " .\n"); totalnumWords++; // Increment the total number of words in … |
Re: Microsoft Network Monitor will allow you to track internet activity by process name and PID. http://www.microsoft.com/en-au/download/details.aspx?id=4865 | |
![]() | Re: > Write a C++ program that reads lines of text from a file using the ifstream getline() method The ifstream getline() method, is different to the std::getline method in that it uses a `char*` - a pointer to an array of characters to hold the data, **not** a std::string object. … ![]() |
Re: You just need to cast sum as type float. float average (int sum, int size) { return static_cast<float>(sum) / size; } | |
Re: line 44 should be `int main()` and obviously return an int value. line 42 `int total_scores(const int [][Cols], int)` line 58 `int total_socres(const int array[][Cols], int Rows)` notice the spelling mistake? line 65 `total = total + array [Rows][Cols];` - so for each iteration you are adding array[3][3] which is … | |
Re: int Clip(int Val) { return (Val < 0 ? 0 : (Val > 0xFF ? 0xFF : Val & 0xFF)); } My simple contribution. | |
Re: Seeing as start and last are both int, you just need to cast &a[1].num1 and &a[0].num1 as type int. `start = (int) &a[1].num1;` Or quite simply you could use: `printf("\nsize of structure :%d bytes", sizeof(a[0]) );` | |
Re: Try running AdwCleaner - http://www.bleepingcomputer.com/download/adwcleaner/ | |
Re: Read the documentation on the SHELLEXECUTEINFO structure at http://msdn.microsoft.com/en-us/library/windows/desktop/bb759784(v=vs.85).aspx In particular regarding the hProcess member. | |
Re: Something like: Qstring str = textEdit->toPlainText(); // TODO convert str to uppercase textEdit->setPlainText(str); ref: http://harmattan-dev.nokia.com/docs/library/html/qt4/qtextedit.html | |
![]() | Re: The way the code is currently written, only the first expression after `if (n > 0)` will be evaluated, provided that n is indeed greater than zero. Rewriting the code using braces it would be equivalent to: x=1; y=1; if (n > 0) { x = x + 1; // … ![]() |
Re: class A { int a[]; // zero sized array }; You should receive a warning when compiling this due to `int a[]` being a zero sized array. | |
Re: > i want to knw how 14.375 float is same as 14.375 double in memory but no so for 14.385. Likely because 14.375 is exactly 14 3/8 which would fit the floating point model used. | |
Re: What are you trying to achieve in line 9 with `count 1` For a default constructor that initializes count to zero: class counter { int count; public: counter() : count(0){ } }; | |
Re: What compiler are you using? The output I get from VS 2012 is: 0 3 8 15 24 | |
Re: In your original code you have: `for (i = 0; i < n; i++)` which increments `i` by 1 for each iteration. The solution is to increment `i` by 2 for each iteration. `i += 2 // equivalent to i = i + 2` | |
Re: > try this:- > 1.ch=getch(); > 2.if(ch=='y') > 3.main(); Please do not do this. Follow Moschops link on loops. `getch()` is not standard and so shouldn't be used. Recursive calls to `main()` are simply a terrible practice and should never be done. | |
Re: Just specify a file size equal to (size of file you're mapping + size of extra data) when you call CreateFileMapping. Read http://msdn.microsoft.com/en-au/library/windows/desktop/aa366542(v=vs.85).aspx - specifically the part about File Mapping Size. | |
Re: You need to put begin and end in your while loop. While num <> 999 do begin // code for the loop goes here // end; Also line 3 isn't needed. I'll leave you to work out the rest. | |
Re: Duplicate post - http://www.daniweb.com/software-development/pascal-and-delphi/threads/454365/please-help | |
Re: By using the key word typedef, you are just defining the struct and no memory is being allocated for it. Hence, `static test *p;` is not pointing to any valid memory location. If using a typedef for your struct use something like: typedef struct _test { int array[10]; } test, … | |
Re: You need to flush the input stream after line 22. Refer to this article for the why and how - http://www.daniweb.com/software-development/cpp/threads/90228/flushing-the-input-stream | |
Re: Untested, but this should work provided you're running in the same session as the target process. if (!IsWindowVisible(hWnd)) { ShowWindow(hWnd, SW_MINIMIZE); ShowWindow(hWnd, SW_RESTORE); } SetForegroundWindow(hWnd); | |
![]() | Re: Use [ChangeServiceConfig2](http://msdn.microsoft.com/en-au/library/windows/desktop/ms681988%28v=vs.85%29.aspx) with dwInfoLevel of SERVICE_CONFIG_DESCRIPTION. ![]() |
Re: Refer to http://www.cplusplus.com/reference/cstdio/fgets/ > A newline character makes fgets stop reading, but it is considered a valid character by the function and included in the string copied to str. | |
Re: Could you post your code for opening and reading the files? What specific problems are you having? | |
Re: #include <iostream> #include <fstream> using namespace std; // code | |
Re: line 9: You're trying to read everything into the same address space - `&image_read[50][100]` Try changing it to - `fscanf(myFile,"%d", &image_read[i][j]);` | |
Re: You're conversion from Fahrenheit to Celsius isn't correct. Try: double celsius(double F) { return F*9.0/5.0 + 32; } | |
Re: You've got `if (isalnum(word[i]))`, which basically means if word[i] is either a letter of the alphabet or numeric, you're failing it. What you want to do is contained in Moschops reply. Check whether `isalpha(word[i])` is false. Also, when you get the new word on failure, you're not resetting `i` and … | |
Re: > But now how to do it with left shift command instead of multiplication? Ask yourself the following: what is the result of 1 << 0, 1 << 1, 1 << 2, 1 << 3 etc Do you notice the pattern? | |
Re: struct aa { char a:3; // the least significant 3 bits of the char int b:30; // bits 0 to 29 of the integer char c:3; }; With regular 4 byte alignment, you'll have a, b and c each using 4 bytes = 12 bytes. > but when i replace … | |
Re: Seeing as you're taking user input for the day, what constitutes a valid day? If I enter 3 for each day, what happens to every other entry in the array? What happens if I enter day values far beyond the bounds of the array? How about non numeric input? If … | |
Re: Yes, I could indeed do that. Could you perhaps be a little more specific as to what a tough program is? | |
![]() | Re: I gather your using TCHARs and most likely compiling as _UNICODE, so try: HRSRC hRes = FindResource (NULL, TEXT("ID_LIBMYSQL"), TEXT("RT_RCDATA") ); ![]() |
The End.