No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.
- PC Specs
- Intel P4 2.4GHz, 512mb Ram, ATI Radeon 128mb
39 Posted Topics
Re: Numerous recursive calls of a function produce delays. The maths is done in the previous answer to your question by Rashakil Fol. Besides this sequence produces really big numbers. I changed the algorithm a bit and even the 50th member of the sequence goes over the boundaries of the long … | |
Hi everybody! I recently wrote a little simulation program, that simulates a real-time elevator system with 3 elevators. Since the code is around 530 lines I presume it is not a good idea to paste it here. There is some number of minor flaws of logical type and I would … | |
Re: Nice. :-) | |
Hi to all! I'm writing a simple simulation program for elevators but i get a problem, namely: [CODE] elevator.cpp: In constructor `Elevator::Elevator(int)': elevator.cpp:41: error: no matching function for call to `Button::Button()' elevator.cpp:10: note: candidates are: Button::Button(const Button&) elevator.cpp:16: note: Button::Button(int, bool) elevator.cpp:41: error: no matching function for call to `Button::Button()' … | |
Re: [left][CODE] [left]#include<iostream> #include<string> using namespace std; class employee { string first; string last; int salary; public: void getdata(void); void setdata(void); employee() { salary = 0; last=""; first=""; } }; void employee::getdata(void) { cout<<"\na first name: " << first; cout<<"\na last name: " << last; cout<<"\nmonthly salary: " << salary; } … | |
Re: Don't forget that C++ gives you the opportunity to use string instead of char[]. Combining this with the usage of find() and substr() can solve your problems. | |
Re: The documentation of your compiler keeps the answers to many "secrets". Besides ALPHA and BETA releases of programs carry these names for the sole reason to say that they are still unfinished. | |
Re: I'm reading your post and I can't really get what the problem is, especially with the decimal.. The reminder you can find using the % operator. More information and details you can find here: [url="http://www.intap.net/~drw/cpp/cpp03_04.htm"]http://www.intap.net/~drw/cpp/cpp03_04.htm[/url] | |
Re: Then consider using another compiler.;) If you want to start over when something in the user's choice goes wrong you can either provide an ethernal loop around the code that should be performed over and over again until the user gives a correct input or use labels. I recommend you … | |
![]() | Re: The simplest way is to use a loop. A for(unsigned long i=user_input; i > 1; i--); could be one solution. |
Re: Since strings in C are arrays of characters and an array is something quite trivial to programming languages, you don't need to import libraries to get strings to work. You can make your life easier, though, by using headers, that include various functions for string manipulation (string.h for example.) The … | |
Re: Although it's not for VC++ you can look through the code of cyber_azis and find some answers. There is a Borland library adapted for Dev-Cpp (another C++ compiler) that gives you the opportunity to create console graphics. There is a topic on this and more detailed explonation in the code … | |
Re: Maybe something like: extern char mir[200]; in test.h can solve your problem ? | |
Re: Simple. Always get stuff from the user as a string. Then check it and get from it what you need. If you don't find it - shoot an error and let a new input be given. There are some lines of code that you pasted there.. it's quite long for … | |
Re: You can write a program to create all these things. Just a random generator for the quantities. The names you can find in adventure books for children, comics, old movies/games or.. in your imagination ;) | |
Re: The last time when I used Pascal was ages ago, but I do remember a function delay(), i.e. delay(6); gives u a delay from 6 seconds. Maybe you need to use Crt (or if there is a new name for it) to get it - this you have to check. | |
Re: [QUOTE] more quesion , namespace is only related to header file?[/QUOTE] No. std is to iostream.h (cstdio.h respectively) but namespaces are just logical units holding whatever belongs in a logical way together. Ex.: [CODE] namespace simple_operations { double sum(double a, double b) { return a+b; }; double mul(double a, double … | |
| |
Re: [CODE] #include <iostream> #include <string> using namespace std; class Account { public: Account(): balance(0.0) {}; inline bool checkpass(string number, string password) { // some way to check number and pass return 1; } inline float GetBalance() { return balance; }; // and so on ... private: float balance; }; int … | |
Re: If you're so kind to post some errors that you get, as well as a brief information about the platform that you're trying to install/use it on, maybe someone can answer you..;) | |
Re: Since everybody is against the idea I'll play for it. Yes, that is Dave! (I'm searching for supporters!:cheesy: ) | |
Re: What you're writing looks a bit more like pure C then C++. You're obviously using headers imported from Pascal to C and C++ respectively (the names of the functions you're using are calling some memories :-) ). Anyway since you're using a low-level language for something, that it's not meant … | |
Re: The sorting you can do in many ways. One way could be putting all the data in let's say a class and then sort the vector of objects with ssort(), qsort() or whatever function you want. Other way could be putting the unsorted lines in a temp file, taking the … | |
Re: What is the connection between running a game and Visual C++ ? It's a bit late here but I can't find an obvious link between the two. The error that you get usualy appears when you cause an undefined (from language point of view) situation in a program. There are … | |
Re: The Art of Assembly is a book that I find quite nice, understandable and deep enough. | |
Re: Since both programs require relatively low knowledge over the language you can try to find a few tutorials and go over them. This doesn't require too much time and it'll get you over the basics. I don't think somebody will write the code for you, but I'm sure somebody will … | |
Re: double in C++ has a 64-bit precision. long double has the same I think, which leaves you with the opportunity to use either double, or if it's not good enough for you, you can use something like this: [url="http://members.lycos.co.uk/keithmbriggs/doubledouble.html"]http://members.lycos.co.uk/keithmbriggs/doubledouble.html[/url] | |
Re: Zeek, in the real world people don't use such numbers. For convenience in different sciences units are defined to mean something when the basic unit is on power (-3), (-6), (-9) and so on (as well as their positive corresponding values). Since you have put time and effort in this … | |
Re: I'm giving you the "I wash my hands" type of answer, namely a link to a tutorial but I hope it would prove to be useful, since it looks like covering all the important stuff. [url="http://www.cpp-home.com/tutorial.php?26_1"]http://www.cpp-home.com/tutorial.php?26_1[/url] is your link. On the other hand - why are you trying to send … | |
Here I paste a simple address book/telephone book. The linker spits the following error: g++.exe derived2.o -o "Derived2.exe" -L"C:/Dev-Cpp/lib" derived2.o(.text$_ZN2ABD2Ev[AB::~AB()]+0x3a):derived2.cpp: undefined reference to `vtable for AB' derived2.o(.text$_ZN2ABC2ESsSsSs[AB::AB(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> >)]+0x3d):derived2.cpp: undefined reference to `vtable for AB' collect2: ld returned 1 exit status … | |
Hi to everybody! Here I paste some simple exercise code that I wrote. The errors are pasted from the compiler log at the end of the source code. The add() function looks ok to me and I can't understand what the compiler wants from me :o Thanks! [CODE] #include <iostream> … | |
Re: Try to simplify your algorithms. Remember that you can combine loop types. This is often useful ;) . Also don't forget the code tags when you post code, because with them it's much more readable. One possible solution I paste below. Enjoy. [CODE]#include <iostream> using namespace std; int main(void) { … | |
Re: [CODE]#include <iostream> #include <string> using namespace std; class weather { private: int day; int month; int year; int temp; int humid; string condition; void leapyear(int); public: weather(int a=1,int b=99,int c=54,int d=100,int e=33,string= "Elie"); //Problem //~weather(); void setall(int,int,int,int,int); int get_day(); int get_month(); int get_year(); int get_temp(int); int get_humid(); void print(); void … | |
Hi! I paste a short sample for a subfunction of a class of mine. I get an error about the declaration of "of" and I'm not quite sure what's wrong :rolleyes: To this I would like to ask if anybody knows how can I check in a new file for … | |
Re: This looks like C to C++. Classes and structures are quite close so maybe you should consider using a class.. Pointers to structures use -> to address structure elements. Since you'll have many similar structures you actually have to consider a dataNode array(in case we stick to structures). Goto is … | |
Hi to everybody! I'm writing a program that has to simulate a working system for deliveries of goods to some cities. I get several mistakes from the compiler while temporarly checking the code but they can't point me out the problem good enough.. Therefore I dare to bother you with … | |
Re: More or less on every operating system you have to cope with folder's attributes to enforce some way of protection to it's contents. One way is being the root of the system and provide the necessary changes to directory's attributes and making it unaccessible for any other user or simply … | |
Hello everybody! I'm quite new to C++ and as exercise I had to write a simple program, trying to duplicate the strcpy(), strlen() and strcmp() functions in C++. The code seems to be ok from syntax point of view but the results are quite unsatisfying :o. If anyone could point … | |
Re: [code]#include <stdio.h> #define BUFSZ 255 struct lala { char name[BUFSZ]; unsigned age; // for example :-) } student[10]; int main(void) { for(int i=0; i < 10; i++) scanf("%s %d", &student[i].name, &student[i].age); // Using scanf() for reading strings is in general not a good idea. // Look at fgets(). It is … |
The End.