1,171 Posted Topics
Re: What exactly do you want? You should explain every detail to increase your chances of getting helped by forum members ... | |
Re: I don't know much about C, but I think it's something like this: [CODE=c] #include <stdio.h> #include <stdlib.h> int main() { /* Create pointers */ int * matrix_one; int * matrix_two; /* Dynamically allocate memory for our matrices */ matrix_one = (int*) calloc(50, sizeof(int)); matrix_two = (int*) calloc(50, sizeof(int)); /* … | |
Re: [QUOTE=hansel13;822867] Now if I type in any word that begins with q or Q, it returns false. Is there away to avoid this? Because I only want the letters q and Q to return false. Not words that begin with q or Q.[/QUOTE] To avoid this problem you should just … | |
Re: Hmm, this makes me thinking about an override somewhere in your program ... What happens if you change: [CODE] int x=astrlen(s1); int y=astrlen(s2); [/CODE] To: [CODE] int x=astrlen(s1)-1; int y=astrlen(s2)-1; [/CODE] ???? | |
Re: Maybe you want to take a look at my code: [CODE=cplusplus] #include <iostream> using namespace std; void func(char **& ref_to_ptr); /* Function declaration */ int main(void) { /* Declare the '2D Array' */ char ** ptr = new char * [5]; ptr[3] = new char[20]; /* Put some data in … | |
Re: You can use them e.g. for a table of char-strings: [CODE=cplusplus] #include <iostream> using namespace std; int main(void) { /* Declare the '2D Array' */ char ** ptr = new char * [5]; ptr[0] = new char[20]; ptr[1] = new char[20]; ptr[2] = new char[20]; ptr[3] = new char[20]; ptr[4] … | |
Re: I like your way of thinking ;) , but in most cases the compiler also mentions where (on which line) the error is located... Didn't the compiler give the line where there was a missing ')' ? | |
Re: -> You get input using 'cin' (e.g. : 'cin >> var;') -> If you store your results you got from the user into an array declared in the function, it is only accessible by the function, not the whole program, you can declare a global array ([B][U]NOT RECOMMENDED![/U][/B]) but it … | |
Re: Definition (?) of a compiler: [CODE] -> A computer program which reads source code and outputs assembly code or executable code -> A computer program that translates highlevel code into machine code [/CODE] | |
Re: I know there's also a seperate thread about C++ Books, but 'C++ Black Book' is a very beginner-friendly book, it explains nearly the whole C++ syntax in detail, step by step ... But it might not be an appropriate choice for you because you only need to learn the basics... … | |
Re: Maybe you should take a look at the following code: [CODE=cplusplus] #include <iostream> #include <string> using namespace std; int main(void) { string usrInput; double dbl = 0; cout << "Enter a percent: "; getline(cin, usrInput); cout << endl; if(usrInput.c_str()[usrInput.length()-1] == '%') { usrInput.replace(usrInput.length()-1, 0, ""); cout << usrInput << endl; … | |
Re: Maybe you should take a look at the following link: [URL="http://msdn.microsoft.com/en-us/library/et4zwx34(VS.71).aspx"]http://msdn.microsoft.com/en-us/library/et4zwx34(VS.71).aspx[/URL] Can you also post all the includes you did in word.cpp? Can you also list the contents of your 'c:\data\dev\cms\3.0.0.0\code\word\src' ? | |
Re: [QUOTE=siddhant3s;818301]You have a internet connection. So go and get "Decent Book" Be with the Standard C++ and just pour all that crap on your answer sheet in the examination , what your teacher expects from you.[/QUOTE] Totally agreed with that:$, it's better to learn the new C++ standard instead of … | |
Hello, My problem is that the program always gives the same output: [CODE]There were no matching numbers !!![/CODE] The source of my program looks as follows: [CODE=cplusplus] #include <iostream> using namespace std; int main(void) { const int MAX_CHARS = 500; const int MAX_NUMS = 5; const int MAX_NUM_CHARS = 25; … | |
Re: I'm just doing what djextreme5 advised you: [QUOTE=djextreme5;817676]You can make a variable and put it as the last line in your loop and output the variable that you created AFTER the loop has finished.[/QUOTE] Try the following code: [CODE=cplusplus] #include <iostream> using namespace std; int main(void) { int i; for(i … | |
While searching the internet I always come across several posts where they're saying that Bloodshed Dev-C++ isn't for advanced use (rather for newbies), why are they saying that? Is MinGW not an advanced compiler? Or is it just because they aren't developping Dev-C++ anymore... I know there's Code::Blocks, but I … | |
Re: Maybe you should try the following code: [CODE] #include <iostream> #include <cstdlib> using namespace std; int main() { system("cls"); double distance, mph, hours; //Get the data cout << " What is the speed of the vehicle in MPH? "; cin >> mph; cout << " How many hours has it … | |
Re: What you need is a good book about C++ (and you also have to read it, otherwise it won't be a good practice). Please check the following thread about C++ books: [URL="http://www.daniweb.com/forums/thread70096.html"]http://www.daniweb.com/forums/thread70096.html[/URL] I personally can recommend the "C++ Black Book", one of the best C++ books ever written, if you … | |
Re: Hmm, seems like it can't find the file 'sys/time.h' What IDE and compiler are you using? (With me this program just compiles/runs perfectly, I'm using the latest MinGW compiler together with the latest Code::Blocks IDE) | |
Re: First of all a few recommendations: - Use '#include <iostream>' instead of '#include <iostream.h>' unless your compiler doesn't support it - Your main function should return a value: for example put 'return 0;' at the end of the main function Ok, now we're taking a look at what exactly you … | |
I'm fairly new to C++ programming and I would like to ask you a (maybe strange) question... The code below compiles correctly with both: - the latest MinGW-compiler - Borland C++ Builder Compiler 5.5 (from the free Command Line tools) However if I run the program (after compiling with the … |
The End.