565 Posted Topics
Re: Here's a small function to get you started. It computes the factorial of a number. You can change it to `long double` if you really need big numbers. Also, `unsigned long long int` is platform dependent, if you have any troubles, swich to another data type. unsigned long long int … | |
Re: `std::string` are different from `C-style` strings (null terminated sequences of characters). For your example, use the `.c_str()` function from the `string` class to get the `C-style` string. std::ofstream Myfile(mystring.c_str()); [Click Here](http://www.cplusplus.com/reference/string/string/c_str/) to get more info. | |
Re: Duplicate thread of: [able2know](http://able2know.org/topic/215867-1) Wikipedia might help you on that: [Click Here](http://en.wikipedia.org/wiki/Damerau%E2%80%93Levenshtein_distance#Algorithm) Learn and understand the ideea behind this methon, than try to apply it on Python. | |
Re: Here's some links to help you figure out a decent solution: [Click Here](http://www.cprogramming.com/tutorial/statickeyword.html) [Click Here](http://www.cplusplus.com/doc/tutorial/classes2/) | |
Re: Here's an useful link [Click Here](http://lmgtfy.com/?q=python+to+exe+converter) But, leaving the joke aside, you could use the py2exe library: [Click Here](http://www.py2exe.org/) | |
Re: Indeed, but, defining your vector as a Q class, will interpret all its objects inside of him as being of type Q, thus, when pushing back `a` and `b`, you are pushing back copies of those object, copies which will be interpret as being of `Q` class, and since `a` … | |
Re: Depending on your needs: are you using a dedicated software for drawing shapes, or are you trying this in a simple fashion way of dots, or?... | |
So, I've opened DW's main page this morning, and I see this:  Is this the normal way? Or have I been gone that long... | |
Re: Whenever you want to you `fstream` as for both input and output operations, you have to explicitly say it when you [open](http://www.cplusplus.com/reference/fstream/fstream/open/) a file. Have a look at a tutorial posted a while on daniweb [Click Here](http://www.daniweb.com/software-development/cpp/threads/6542/fstream-tutorial) So, to be of any service, change this in your code: fstream myFile … | |
Re: Do you have to count the punctuation also? Because in your example, you have a comma (`','`) and a dot (`'.'`), which, even though the words may be palindrome regarding the sentence, would point that your sentence is not a palindrome. Also, is it a homework requirement to actually use … | |
Re: Well, I have something that might help you. This will get the last character of each line, which, by your columns, should be the heighest in that line, and will get it's position from the last line, which presumably defines the "columns". **Note: This applies only if the file is … | |
Re: You'll be needing an array of integers to store for each student his corresponding number of Research projects. Knowing that each student takes a place in the array, you can parse it first adding the corresponsind number of research projects, and on the way, you can keep in memory the … | |
Re: As Schol-R-LEA said, I doubt that your problem resides in using <ios> or <iostream> in your includes. | |
Re: You could try using `ifstream` for file input, and `ofstream` for file output. Also, I would suggest using a map for storing(in memory) your users and their respective passwords. Another thing, try using `string`s instead of char array. They are more reliable, and you can do much more with them. … | |
Re: Well, searching on google isn't that hard: Function overload: [Click Here](http://www.cplusplus.com/doc/tutorial/functions2/) (middle of the page). Operator overload: [Click Here](http://www.cplusplus.com/doc/tutorial/classes2/) | |
Re: Well, if the file is not that big, you could use a buffer (`stringstream`). Here's a small example: #include <fstream> #include <string> #include <sstream> int main(){ std::string filename = "a.txt", line; std::ifstream fin(filename.c_str(), std::ios::in); if (fin.good()){ //check if the file exists and can be read std::stringstream bufer; //buffer to store … | |
Re: Here's a related thread: [Click Here](http://stackoverflow.com/questions/270455/is-it-possible-to-program-iphone-in-c) | |
Re: I do want to know though, are you familiar with classes in Python, or you didn't get that far into the subject at your school? Because if you can use classes, this will be easy. Also, a modular/function approach will be required if classes are not available. | |
Re: This is a head start: [Click Here](http://pentangle.net/python/handbook/node52.html) Also, dig around a bit, you'll find plenty more, or just hit on google python reserved words/python reserved imports. As for the imports, before naming a module, make sure you check the name in the documentation, [Click Here](http://docs.python.org/2/library/index.html), to see if the name … | |
Re: This is not how we do things around here. First, you give us your attempt at solving the problem you're dealing with, and than you ask a speciffic question, related to your code and/or problem. | |
Re: > but a better solution would be to use std::strings instead of char*s and since this is C++, it would be advised to use `std::string` when dealing with strings. `std::string` class offers a lot of string manipulation methods and other handy features. Have a look at them: [Click Here](http://www.cplusplus.com/reference/string/string/) | |
Re: Here are some troubleshot advices: [Click Here](http://www.tech-faq.com/io-device-error.html) Aditionally, open a command window (start-run-cmd) and type this: C:\>cd D:\ than C:\>d: If you did connect to the hardware type `ls` or `dir` in order to see if the OS recognizes your files: D:\>dir | |
Re: What is that suppose to mean? By this post you have broken several rules: **1. Do post in full-sentence English 2. Do use clear and relevant titles for new articles 3. Do not write in all uppercase or use "leet", "txt" or "chatroom" speak 4. Do read the forum description … | |
Re: You could use google/your course book for such a question, since its answer is almost trivial. #include <string> bool cmp(string a, string b){ return a == b; } Also, have a look at this: [Click Here](http://www.cplusplus.com/reference/string/string/compare/) | |
Re: Presumably `_getScript()` returns an object if all went well, or a `none` object otherwise. You could test if your `script` variable is `none`, provided that your `_getScript()` function supports returning `none` values. Was this your question, or did I interpret it wrong? | |
Re: You could try do delete the actual bullet item from the list: for bullet in bullets: crect = pygame.Rect(bullet[0] - 3, bullet[1] - 3,3*2,3*2) shoot = pygame.draw.circle(screen,(255,255,255),(crect.center),3) if crect.colliderect(Boss): bullets.remove(bullet) | |
Re: See if this is of any help to you: [Click Here](http://social.msdn.microsoft.com/Forums/en-US/vscrystalreports/thread/79e1da80-f5c6-42fa-80ca-65a10de5729d/) | |
Re: Here, this should clarify a bit the need of classes in a high level programming language: [Click Here](http://www.c-sharpcorner.com/uploadfile/daniel.clark/basics-of-creating-and-using-classes-in-C-Sharp/) | |
Re: That means that you saved in your python folder (when using the ide) a file which is named tkinter.py or a file which name is the same with some original python file. Try looking into your python folder (i.e. `C:\\Python273` or `C:\\Python3.3`) and find that file, and change its name. | |
Re: You could use the [stringstream](http://www.cplusplus.com/reference/sstream/stringstream/) class. | |
Re: > so we can build off of it? We usually don't build off of user code, but we do try to offer solution to existing problems regarding a given code. To complete **<Michael>**'s statement, I shall give you the exact rule from our [**Member rules**](http://www.daniweb.com/community/rules) (which you sign on upon … | |
Re: > Subject: READ THIS FOR YOUR OWN GOOD... It's just me, or when I see the subjects of my e-mails in this form, I just delete them automatically? But again, > The same is not true of everyone, and if such an email arrives in the inbox of someone with … | |
Re: names = deque(['raymond', 'rachel', 'matthew', 'roger', 'judith', 'charlie', 'melissa', 'betty']) Will asign a new list to the variable `names` which than will no longer be pointing to the same memory address that `nmls` does (which it did till than by assigning `names` to `nml` : `names = nmls`), thus making … | |
Re: Recursively calling the main() function (lines 16 to 21) if the input is incorrect it's not good at all. An easy fix would be this: odom2 = odom1 = 0 while (odom1<=1): odom1 = int(input("Please enter a starting value for the odometer: ")) if odom1 <= 1: print("Odometer reading must … | |
Re: Have you tried reading the documentation for the logging part? [Click Here](http://docs.python.org/2/library/logging.html) | |
Re: Here you go "oldie": [Click Here](http://www.daniweb.com/home/donate) | |
Re: If you need to replace the first two letters, you can access them directly: string s = "name"; cout<<s[0]<<endl; cout<<s[1]<<endl; thus s[0] = 'x'; s[1] = 'x'; | |
Re: That error means you're on Python 2.7.3 or Python 2.7.2; the thing is that there's a difference between the function `'input()'` and the funtion `raw_input()` (`raw_input()` is prior to Python 3.x). `input()` needs a number to be inserted, otherwise it will throw an error if strings are inserted (which is … | |
Re: Try changing long n3 = Math.round(Math.random()*1000); whith long n3 = Math.round(Math.random()*(999 - 100) + 100); You'll need to define a range. One way of doing that is by this: Math.random() * (Max - Min) + Min where `Max` would be the maximum three digit number, and `Min` the lowest three … | |
Re: You could use a dictionary, on which you map every character from your alphabet with the key character: def cryptography(text): alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz .,;'\"\\[]{}=-+*\|:<>?" key = "XPMGTDHLYONZBWEARKJUFSCIQVxpmgtdhlyonzbwearkjufsciqv .,;'\"\\[]{}=-+*\|:<>?" crypt, decrypt = {}, {} #dictionaries for crypting and decrypting for i, j in zip(alpha, key): crypt[i], decrypt[j] = j, i #fill … | |
Re:  I would love one of that... | |
Re: As much as we would like to help you, we must see that you've tried first. Show us the code you have so far. > Spoiler alert: there aren't any numbers which are in both lists. | |
Re: No: #include<iostream.h> or #include<conio.h> or #include<fstream.h> or #include<string.h> One of the buggs resides on line 21. And also, don't read the file character by character, rather try to read the whole line, and than make moddifications on it. But I won't give any hops to this code, because it's... obsolete! | |
Re: I prefer iPhones, because I believe them to be more robust than other android-looking phones, but this is debatable. They both have advantages and disadvantages. It actually comes down to the user preferences: if you like a solid, but more restrictive environment, you should choose iOS, if you like a … | |
Re: I guess this works as well: def cipher(message, shift): return ''.join([chr(ord(i)+shift) if i.isalpha() else i for i in message]) | |
Re: > This error is returned if an incorrect protocol is explicitly requested in the socket call, or if an address of the wrong family is used for a socket, for example, in sendto. What do you think this refers to? And btw, why are you trying to get a new … | |
Re: Write each function, for save, and for save as, than add a button, one for the save, and the other for the save as function, or you can use the `tkinger.filedialog` to aid you in that. Here are some links to help you: [Click Here](http://tkinter.unpythonic.net/wiki/tkFileDialog) [Click Here](http://docs.python.org/3.0/library/tkinter.html) Here are some … |
The End.