15,300 Posted Topics
Re: why not just check if the runtime files are in the c:\windows directory? | |
Re: in a loop, use % operator to get the last digit, then /= operator to shift digits right and drop the last digit. [code] #include <iostream> #include <string> #include <algorithm> using namespace std; int main() { int x = 123; string a; while(x > 0) { int n = x%10; … | |
Re: unions are used whenever the same data can be represented in two or more ways, or by two or more data types. Normally I think unions are place inside structures, something like a [URL="http://www.canaimasoft.com/f90vb/OnlineManuals/UserManual/TH_34.htm"]VARIANT structure[/URL]. This structure has two members, an integer that tells which of the union members are … | |
Re: Use a friend function to overload the >> operator [code] class Time { private: int hour, minute, second; public: Time() {hour = mijnute = second = 0;} friend istream& operator >> (istream& in, Time& t); }; // Put this in the *.cpp file, not the *.h file istream& operator >> … | |
Re: We only help those who help themselves. Post the code you tried. You will have to know a little about pointers if you are required to pass variables by reference. | |
Re: AFAIK there are no other FREE compilers for *nix. >>in labs we use the CC compiler I think that CC is just a generic name for *nix compilers. The real compiler could be almost anything. | |
Re: [URL="http://lmgtfy.com/?q=c%2B%2B+web+services"]try this[/URL] | |
Re: And of course it will depend on what operating system you are using. | |
Re: what compiler are you trying to install. I don't have my crystal ball with me so you will just have to post it. If you are trying to install Turbo C on Vista then you can forget it because that compiler will not install on Vista. Get a modern compiler … | |
Re: more than likely attempting to write beyond the bounds of an array. Locating the error in large programs can be difficult. One method I have used is to comment out large blocks of code until the problem goes away. | |
Re: How do you know which of the two methods are called? Neither actually do anything (just do-nothing methods) | |
Re: >>i can't understand what these parameters means There are only two of them :icon_eek: [URL="http://linux.about.com/library/cmd/blcmdl3_execvp.htm"]Read this[/URL]. [quote] The execv and execvp functions provide an array of pointers to null-terminated strings that represent the argument list available to the new program. The first argument, by convention, should point to the file … | |
Re: So what's the big problem? You might have to change the structure of the whole problem, such as make a menu such as [quote] 1. Add new string to file 2. Display file contents 3. Quite [/quote] Then create a switch statement that processes the requested action. | |
Re: It depends on the program you write. [URL="http://social.msdn.microsoft.com/forums/en-US/vclanguage/thread/691bd371-f659-4f95-8ac9-ee538f0cf6f6"]You might read through this[/URL] rather old thread to see if it gives you any ideas. | |
Re: If you are going to use new on line 16 then you have to delete[] it sometime later. Without that your program has a huge memory leak. Avoid that whole issue by not using pointers, declare the array on the stack. 30 strings is not going to cause stack overflow. … | |
Re: C programs do not need all those typcasts. Only C++ requires them. Why are you using all those difficult-to-follow pointer arithmetic? It would be much simpler and clearer to just use normal array indices via [] operator. [code] ptrB= calloc(row,sizeof(int *)); ptrC= calloc(row,sizeof(int *)); for (counter1=0;counter1<row;counter1++) { ptrA[counter1] = calloc(column,sizeof(int)); … | |
Re: Try Code::Blocks. It works ok on Vista, so it will probably be on on Windows 7 too. | |
Re: It's not that I know more than you, which may or may not be correct. But I've been here longer, answered more posts, and have been involved in more closed threads. 15 days ago [URL="http://www.daniweb.com/forums/thread226920.html"]I asked Dani to reduce my rep power [/URL]because I thought it was just excessive, which … | |
Re: try this: compiled with vc++ 2008 express [code] #include <windows.h> #include <iostream> using std::cin; int main() { HWND hWnd = GetConsoleWindow(); ShowWindow(hWnd,SW_MAXIMIZE); cin.get(); return 0; } [/code] | |
Re: >>when I compile, there are no errors, Ditch the compiler and use a different one. There is a link error. >>void print () Wrong. should be [icode]void testClass::print ()[/icode] | |
Re: you mean this?? [code] std::string command = "wget http://www.google.com"; system(command.c_str()); [/code] | |
Re: [URL="http://www.gillius.org/ctut/app_a.htm"]Here is a complete list[/URL] | |
Is is possible for you to reduce the amount of negative rep I can give from 30 to something more reasonable, say 10? I'd like to occasionally give negative rep but I don't want to completely destroy the member. Maybe there should be a maximum negative rep that can be … | |
Re: Please don't use it. Get [URL="http://www.codeblocks.org/"]Code::Blocks.[/URL] | |
Re: [URL="http://www.cplusplus.com/reference/clibrary/cstdio/scanf/"]read this[/URL]. I'm not going to do your homework for you. BTW there is no such thing as "%n" in scanf. The link I give you contains all the valid characters you can put after the % sign. | |
Re: You need two loops to do that. You have to check each number against all the previous values. [code] int a[10] = {5,6,7,8,9,10.11,12,13,1}; int i,j,isTrue; isTrue = 1; // assume true for(i = 0; i < 9 && isTrue == 1; i++) { for( j = i+1; j < 10; … | |
Re: either fmod() or modf(), I'm not sure which one you want. Use google and look them up if you don't know what they do. | |
Re: First you will need a medical degree so that you know how to recognize a cataract when you see one. My eye specialist had to shine a bright light in my eyes in order to find them. Maybe you can do the same with a color picture -- maybe not. … | |
Re: line 41: That is a horrible way to test for eof -- all you need is this: [code] while( getline(inputFile, line) ) { cout << line << '\n'; } [/code] lines 55-60: WTF??? You can not code nested while loops like that and expect anything other than the results you … | |
Re: use the mod % operator to check of the number is odd or even. When (number % 2) == 0 the number is even. make the data type of [b]number[/b] an int, not a char because you can't enter a number greater than one digit in a char. You will … | |
Re: You are passing vowel incorrectly. The & symbol is used in main to pass vowel by reference, then the * pointer is used in the actual function [code] void generate_random_vowel (char* vowel) { *vowel = 'a'; } int main() { char vowel; generate_random_vowel( &vowel ); } [/code] | |
Re: write MS-Windows Device Drivers -[URL="http://en.wikipedia.org/wiki/Windows_Driver_Kit"]- get the DDK here[/URL] | |
Re: lines 74-80: you don't need to call strcmp() to compare two std::string objects -- just use their == operators [icode] if(type == normal)[/icode] Recode lines 98-105 similarily. Also those if statements will give you a false validity result. Lets say the type is gold. The very first if statement about … | |
Re: Edit your post and use code tags to make it easier to tell you what is wrong with it. For starters, you do not need the two variables called yes and no. What you have to do is check for 'y' or 'n' [icode]if( yn == 'y') [/icode] And remember: … | |
Re: put a system pause between letters. Assuming you are coding on MS-Windows. [code] #include <windows.h> ... ... string msg = "This is a test"; for(int i = 0; i < msg.length(); i++) { cout << msg[i]; cout.flush(); sleep(1000); // delay 1 second } [/code] | |
Re: y not? stdio.h is not used in c++ programs, only C programs. conio.h is not recommended because its no-standard and not supported by very many compilers. stdio.h defines FILE structure and associated functions. This is for file read/write. In c++ programs we would use <fstream> instead of stdio.h | |
Re: First problem is that aPtr is declared in the class constructor. It needs to be declared in the class itself so that it can be accessed by other class methods. What is [b]cArray[/b]? You should probably post the class itself so that we can see what you are doing. | |
Re: [QUOTE=ardav;1005209]Sorry cscgal, saw the up/downs were grey and assumed they were disabled. Why are they greyed out?[/QUOTE] Probably because people were complaining about them being in color. But if you click up or down array the arrow will change color. In another post Dani said we would be able to … | |
Re: That code is already sending something on line 41. | |
Re: There are lots of different compilers for the same os too -- its called competition. | |
Re: Learn to read [URL="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.checkbox.aspx"]MSDN articles[/URL] You will have to test each checkbox to determine its state (checked or unchecked) | |
Re: Interesting assignment, except for the requirement to use [icode]system("cls")[/icode] to clear the screen. But that's your teacher's problem, not yours. 1) Your validation for months should test if the number entered is less than 1 or greater than 12. If it is, then print an error message and make the … | |
Re: >> pszFileText = LPSTR(GlobalAlloc(GPTR, dwFileSize + 1)); typecast is wrong: [icode] pszFileText = (LPSTR)GlobalAlloc(GPTR, dwFileSize + 1);[/icode] Add this to the top of the *.rc file [icode]#include <winuser.h>[/icode] You have to add comctl32.lib to the list of libraries. For your compiler it probably has *.a extension instead of *.lib. | |
Re: The last example can't be compled with the express edition. | |
Re: After calling CreateProcess() call WaitForSingleObject(). When that returns then you can call GetExitCodeProcess() | |
| |
Re: how is d_player declared? If it an array of character strings then you may need this: [icode]if( name == d_player[i])[/icode] | |
Re: line 6: its [b]int[/b] main(). c++ does not allow default function return types. lines 4 and 5. Move those down so that they are within main() and not global variables. Globals are bad and can normally be avoided. line 10: Entering numeric data types such as integers leaves the '\n' … |
The End.