- Strength to Increase Rep
- +0
- Strength to Decrease Rep
- -0
- Upvotes Received
- 5
- Posts with Upvotes
- 5
- Upvoting Members
- 5
- Downvotes Received
- 1
- Posts with Downvotes
- 1
- Downvoting Members
- 1
I am here to learn, just like anybody else. - *Learning from the best, sharpening my programming skills.* I try to enjoy myself as much as possible, and take pleasure in whatever I am doing. :) Interests: Linux, Bash Scripting, C++, PHP, MySQL, Qt, Perl
- PC Specs
- Nothing fancy, solid dual-core machine for desktop, and a single core headless server, built from spare…
38 Posted Topics
Re: In order to perform operations on your data, you need to load it in the memory in way it is convenient for you to use. If I were you, I would make a structure or class for that purpose - which can hold the data of one record. Then I … | |
Re: You might want to look into STL's [URL="http://www.cplusplus.com/reference/iostream/stringstream/"]stringstream[/URL] for your project. | |
Re: Probably something is wrong with your includes. In code::blocks, when you add a new file to a project you need to mark them to be included, otherwise you will get an error when you try to compile it. Add them to the project again, or include them manually. - Include … ![]() | |
Re: It compiles, but I've got a runtime error, probably because the constructor of class inventory requires a file called "products". Also reading the lines until [icode]!eof[/icode] will make the last element appear twice in your vector, but that's not the real issue. I don't want to be rude, but the … | |
Re: Probably you will hate for me saying this, but I don't think you understand how classes really work. If I were I would step back from this assignment, and make a simple class instead, and play with it until I understand the basics. Just write a simple one, with get/set … | |
Re: This is an example to how to get the arguments from the command line: [code]#include <iostream> int main ( int argc, char *argv[] ) { std::cout << "Number of arguments: " << argc << std::endl; for ( short i = 0; i < argc; ++i ) std::cout << argv[i] << … | |
Re: Strictly this is more like C than C++. :X | |
Re: Your code reminds me of my early days of programming. :) I had an assignment once, and as a student I was very eager to write it, so I jumped right at it. I started to implement all the functions one by one, and I thought I was doing pretty … | |
Re: You shouldn't put all your arrays in the stack, your program might cause stack overflow, especially when 'n' is chosen to be a large number. You may know what your program is doing, but did you consider what happens if someone else runs it and picks 'n' to be a … | |
Re: Read the following link: [URL="http://www.parashift.com/c++-faq-lite/freestore-mgmt.html#faq-16.3"]http://www.parashift.com/c++-faq-lite/freestore-mgmt.html#faq-16.3[/URL] | |
Re: He is right, there is no pow( int, int ), but maybe(slight maybe) you won't need that at all. There is a shortcut, you can change the base field format of the stream, so you can work on your hexadecimal numbers just like regular numbers. After all, everything in the … | |
Re: I've never used Turbo C++, but you can get similar results by moving the cursor backwards, and then replacing the letters with white spaces. [CODE]std::cout << "2 + 2 = 4\b5" << std::endl; // replaces 4 to 5 std::cout << "erase\b\b " << std::endl; // replaces "se" with white spaces[/CODE] | |
Re: Avoid that code above. First of all it doesn't work at all, aside from that, main has no return type, and has no return value either, and that's bad, very bad. Using system("pause") is also not recommended, use cin.get() instead. [code]if ((k%2!=0)&&(k%3!=0)&&(k%5!=0)&&(k%7!=0))[/code] This statement only checks if a number can … | |
Re: I just want to remind you for a few thing: Getline only reads until the first delimitation character is found which is by default is '\n' the new line character. Keep that in mind, that you can't read 10000 characters in a c-style string, there are only 9999 available space, … | |
Re: It will be a private, this is the default behavior. Any member of your class will be private by default, even your constructors. | |
Re: You need Java Virtual Machine in order to execute a jar file. You can associate jar files with JVM, or just right click on it, then click on "open with" and select java. You are looking for 'JRE', Java Runtime Environment. | |
Re: Oh Lord! What have you done?! This is a friendly advice, but before you go any further in the realm of virtual functions, you should go back and review how structures/classes and inheritance work. I am sorry to burst your bubble, but you didn't beat the compiler. With a few … | |
Re: Come on, think. :) This is very easy. How do we convert from 24h notation to 12? When someone says it's 23:00 you know, it is 11:00 pm, or 22:00 is 10:00 pm 21:00 is 9, 20:00 is 8. [QUOTE=This is a spoiler!] 24 -> 0 23 -> 11 22 … | |
Re: It's been a long time I coded in C, but I don't see any C++ type streams, or std containers, mostly printf, scanf, fprintf, fscanf, fgets, and pointers everywhere. I am sorry, are you coding in C or C++? | |
Re: There are lot of mistakes in your code. First of all, use vectors instead of arrays. Arrays are evil, and can cause you a lot of headaches, when they go wrong. I am sorry, but almost all of your functions are wrong. :( You are trying to pass your arrays … | |
Re: I really don't want to confuse you but there is another solution you might be interested in. It is called polymorphism. With the use of polymorphism you would only need one type of pointer. One of the benefits of polymorphism is, that you can have the same functions in the … | |
Re: Probably it won't crash your computer, your operating system won't let it happen. | |
Re: First of all it would be a lot safer to use STL's stringstream, instead of extracting the input stream's content this way. There are a few things I would like to mention. In your main function you did not cout your complex class, that is one of the reasons why … | |
Re: If you are new to C++ I would not recommend you to jump into Qt or C#. Qt is based on C++ and C#'s design is also influenced by C++. If you not familiar with the basics, you will end up constantly bumping into problems, and you certainly won't be … | |
Re: Everything in the memory is in hex. :) Converting numbers to one base to another is fun, however there is a better solution for this. [URL="http://www.cplusplus.com/reference/iostream/manipulators/hex/"]http://www.cplusplus.com/reference/iostream/manipulators/hex/[/URL] [CODE]//http://www.cplusplus.com/reference/iostream/manipulators/hex/ #include <iostream> using namespace std; int main () { int n = 15; cout << hex << n << endl; cout << dec … | |
Re: In code::blocks if you don't mark your files in your project to be globally included, the compilation later won't be successful. In that case you have to include them manually. Did you try to include "character.cpp" in your main function? I am just guessing here, but I had troubles with … | |
Re: You didn't declare those variables, simply put they do not exist. In order to use them you need to declare them first. It is safe to say those 3 should be the parameters of your function. Change the function inline definition accordingly, you may also want give them a type, … | |
Re: [CODE]for (char **curr_point = parr, **bound_point = parr + maxStrings; curr_point < bound_point; ++curr_point)[/CODE] Please someone correct me, if I am wrong but, I don't think it is safe to use such addition : **bound_point = parr + maxStrings; maxStrings = 5 it's an int. The size of a char … | |
Re: Well you just need to declare your functions in your class. [CODE]#ifndef MYCLASS_H #define MYCLASS_H class MyClass { private : int value; float value_float; void foo (); // private function of this class public : // constructors MyClass (); MyClass ( const int& ); //public functions of your class void … | |
Re: If you cout these two, you will understand what is the difference between 1.0 and 1. [CODE]std::cout << ((1 * 10) - 50) / 15 << std::endl; // -2 std::cout << ((1.0 * 10) - 50) / 15 << std::endl; // -2.66667[/CODE] Your code: [CODE]float RoD = 0.5; int level … | |
Re: You can't. You simply need to declare a constructor with no parameters/arguments. [CODE]class A { public : A (); // constructor with no arguments A ( int ); // constructor with one argument . . . A ( int, int, int ); // constructor with three arguments private : int … | |
Re: Have you tried to comment out the functions one by one, and then putting them back together? So, that way you could find, where is the point when your program starts to hang. Not a sophisticated way of debugging, but it might help narrowing the odds. | |
Re: I am wondering under Linux what would 'echo $?' give you back, after you run a program with no return value. My attempt to make such a program have failed : void.cpp:3:12: error: ‘::main’ must return ‘int’. - I am still curious though. @manfredbill - The problem is you are … | |
Re: Then you should definitely give a shot to Qt. It easy to work with, and quite well documented. You can create applications with the use of QTcpSocket, and QUdpSocket. - I did. There are many examples out there, however learning can be tricky some times. - Well, I had trouble … | |
Re: Well, in my opinion you have to ways to do that. Either you utilize your memory and increase your application's speed, or you use less memory but then you will end up with more number crunching - thus getting the results back will take more time.( A lot more with … | |
Re: We don't know what you've learned, so it is hard to suggest anything, but if you really want to practice, try to solve the problems posted in the other threads. Pick something for your own size, and go for it. :) | |
Re: I don't want to be rude, but at least take the time to search the forum, there are dozens of threads about pointers and reference. Or google it, you will find tons of pages related to this topic. Btw, did you know, you can find C++ lectures from Stanford on … | |
Re: Oh Lord, that's why the std containers were invented on the first place. Dealing with pointers can be a pain in the neck. They are hard to debug, and one mistake can easily lead to memory leaks. One advice, in C++ use the new operator, instead of using malloc that's … |
The End.