Search Results

Search found 211 results on 9 pages for 'professor frink'.

Page 7/9 | < Previous Page | 3 4 5 6 7 8 9  | Next Page >

  • How to read a string one letter at a time in python

    - by dan
    I need to convert a string inputed by a user into morse code. The way our professor wants us to do this is to read from a morseCode.txt file, seperate the letters from the morseCode into two lists, then convert each letter to morse code (inserting a new line when there is a space). I have the beginning. What it does is reads the morseCode.txt file and seperates the letters into a list [A, B, ... Z] and the codes into a list ['– – . . – –\n', '. – . – . –\n'...]. We haven't learned "sets" yet, so I can't use that. How would I then take the string that they inputed, go through letter by letter, and convert it to morse code? I'm a bit caught up. Here's what I have right now (not much at all...) morseCodeFile = open('morseCode.txt', 'r') letterList = [] codeList = [] line = morseCodeFile.readline() while line != '': letterList.append(line[0]) codeList.append(line[2:]) line = morseCodeFile.readline() morseCodeFile.close() userInput = input("Enter a string to be converted to morse code or press <enter> to quit ")

    Read the article

  • Implementing Drag and Drop using MouseListener for custom Components

    - by Chris Lieb
    I am working on a school assignment that requires me to be able to pick up a tile, drag it to a location, then drop it there. I was able to get this working using TransferHandler and a bunch of stuff from the dnd package, but this is not an acceptable way to perform this action for this assignment according to the professor. So, I am trying to achieve the same effect using the MouseListener interface. The basic setup is this: I have a JPanel-derived class called LocationView that contains JLabel-dervived instances of TileView. I need to get events that give me the LocationView that has the mouse pressed on and the LocationView that has the mouse released on. I am proxying mouse events through the TileView to its containing LocationView so that I can properly handle the mousePressed event. I added System.out.println()'s to the mouse listeners for mousePressed and mouseReleased to both LocationView and TileView so that I could observe the events that were being generated. To my surprise, pressing the mouse on Tile A in Location A, then dragging to Location B and releasing would generate a mouse released event for both Tile A and Location A, but not for Location B. I need the mouse released event triggered for only Location B. To try to work around this, I tried implementing a glass pane based off of the FinalGlassPane found at http://weblogs.java.net/blog/2006/09/20/well-behaved-glasspane. After adding the glass pane and adding an event listener for it, I can see that the mouse events are indeed filtering through the glass pane, but the mouse released event is still only being called on the item the mouse was clicked on. Is there a way to have mousePressed and mouseReleased events associated with the same drag action be called on separate components?

    Read the article

  • Question about using adaptive layout + print style sheet

    - by Michael
    Hey everyone, In my web design class, we looked at creating different style sheets for different window sizes and using a javascript that detects the window size and loads the right style sheet. In the head, I'm linking to three external style sheets, as well as a link to the javascript file. So the adaptive layout works fine. However... I also need to be able to use a print style sheet with this particular webpage (it's the requirement for this project). The problem is this that the way the javascript was written makes it so that it ignores the print style sheet. When I go to print preview, it ignores the print style sheet and the preview shows me all of my webpage unstyled. It looks like just the html when opened in a browser. I am using the javascript by Kevin Hale at ParticleTree, and I'm sure there are those familiar with this :] http://particletree.com/examples/dynamiclayouts/ I would like to know what needs to be changed so that the print style sheet isn't ignored. I've shown this to my professor. However, her email wasn't clear enough, but I understand that somehow the script is ignoring the print.css and that's why the print preview shows a css-less preview. Since it's the weekend, I won't be able to get an answer until Monday, and I was hoping someone can help me out. Thank you very much! Michael

    Read the article

  • How to create extensible dynamic array in Java without using pre-made classes?

    - by AndrejaKo
    Yeah, it's a homework question, so givemetehkodezplsthx! :) Anyway, here's what I need to do: I need to have a class which will have among its attributes array of objects of another class. The proper way to do this in my opinion would be to use something like LinkedList, Vector or similar. Unfortunately, last time I did that, I got fire and brimstone from my professor, because according to his belief I was using advanced stuff without understanding basics. Now next obvious solution would be to create array with fixed number of elements and add checks to get and set which will see if the array is full. If it is full, they'd create new bigger array, copy older array's data to the new array and return the new array to the caller. If it's mostly empty, they'd create new smaller array and move data from old array to new. To me this looks a bit stupid. For my homework, there probably won't be more that 3 elements in an array, but I'd like to make a scalable solution without manually calculating statistics about how often is array filled, what is the average number of new elements added, then using results of calculation to calculate number of elements in new array and so on. By the way, there is no need to remove elements from the middle of the array. Any tips?

    Read the article

  • How do I make software that preserves database integrity and correctness?

    - by user287745
    I have made an application project in Visual Studio 2008 C#, SQL Server from Visual Studio 2008. The database has like 20 tables and many fields in each. I have made an interface for adding deleting editing and retrieving data according to predefined needs of the users. Now I have to Make to project into software which I can deliver to my professor. That is, he can just double click the icon and the software simply starts. No Visual Studio 2008 needed to start the debugging. The database will be on one powerful computer (dual core latest everything Windows XP) and the user will access it from another computer connected using LAN. I am able to change the connection string to the shared database using Visual Studio 2008/ debugger whenever the server changes but how am I supposed to do that when it's software? There will by many clients. Am I supposed to give the same software to every one, so they all can connect to the database? How will the integrity and correctness of the database be maintained? I mean the db.mdf file will be in a folder which will be shared with read and write access. So it's not necessary that only one user will write at a time. So is there any coding for this or?

    Read the article

  • How to motivate as a project leader?

    - by Zenzen
    Ok so some of you might think this is not stackoverflow related, but since I got a similar question during an interview (for a J2EE dev position) I think you guys will help me in the end. The situation is simple: you're working on a project in a small group (4-5 people), you're the project leader and the guy who's the most competent (technology wise) is also slacking the most. What do you do to motivate him? The problem is, I'm having the same issue at the university - this semester we have a lot of projects going on (6 to be exact) so we decided to dived the work so everyone will do 1-2 projects in a technology he knows/wants to learn. It's been working well for the most part, the problem is the person whom we thought would finish his project way before us as he's the most experienced among us. How am I supposed to make him do his share properly? Till now he was just half assing his part by doing the bare minimum, with which the professor wasn't really pleased to say the least... Now it's only a university project, but in the future I might have the same problem in a real job and losing a really smart and experienced worker (as firing him is the only solution I can come up with now) would really be a waste. Aren't there any better ways? p.s. now that I think about it, are there any books that would help me in becoming a better project manager?

    Read the article

  • How to write a Criteria Query when there's an <any> association

    - by Bevan
    I'm having some trouble constructing the correct Criteria to do a particular query - after an afternoon of consultation with Professor Google, I'm hoping that someone can point me in the right direction. I have two entities of interest: OutputTsDef and NamedAttribute What I'm trying to do is to find all OutputTsDef that have a particular NamedAttribute value. I can write a detached Criteria to find all NamedAttributes that have a given name and value: var attributesCriteria = DetachedCriteria.For<INamedAttribute>() .Add(Expression.Eq("Name", "some name")) .Add(Expression.Eq("Value", "some value")); How do I inject this in to a query for OutputTsDef to restrict the results? var criteria = nHibernateSession.CreateCriteria(typeof(IOutputTsDefEntity)); // What do I write here? var results = criteria.List(); NamedAttribute looks like this - note the use of [Any] as we can have NamedAttributes on many kinds of entity. [AttributeIdentifier("DbKey", Name = "Id.Column", Value = "NamedAttributeID")] [Class(Table = "NamedAttributes")] public class NamedAttribute : BusinessEntity, INamedAttribute { [Any(0, Name = "Entity", MetaType = "System.String", IdType = "System.Int32")] [MetaValue(1, Class = "Sample.OutputTsDef, Sample.Entities", Value = "OTD")] [MetaValue(2, Class = "Sample.OutputTimeSeriesAttributesEntity, Sample.Entities", Value = "OTA")] [Column(3, Name = "OwnerType")] [Column(4, Name = "OwnerKey")] public virtual IBusinessEntity Entity { get; set; } [Property(Column = "Name")] public virtual string Name { get; set; } [Property(Column = "Value")] public virtual string Value { get; set; } ... omitted ... } In regular SQL, I'd just include an extra "where" clause like this: where OutputTsDefId in ( select distinct OwnerKey from NamedAttributes where Name = ? and Value = ? and OwnerType = 'OTD' ) What am I missing? (Question also posted to the NHUsers mailing list - I'll copy any useful information from there, here.)

    Read the article

  • Does a CS PhD Help for Software Engineering Career?

    - by SiLent SoNG
    I would like to seek advice on whether or not to take a PhD offer from a good university. My only concern is the PhD will take at least 4 year's commitment. During the period I won't have good monetary income. I am also concerned whether the PhD will help my future career development. My career goal is software engineering only. Some of the PhD info: The PhD is CS related. The research area is Information Retrieval, Machine Learning, and Nature Language Processing. More specifically, the research topic is Deep Web search. Some of backgrounds: I worked in Oracle for 3 years in database development after obtained a CS degree from some good university. In last year I received an email telling an interesting project from a professor and thereafter I was lured into his research team. The team consists of 4 PhD students; those students have little or no industry experiences and their coding skills are really really bad. By saying bad I mean they do not know some common patterns and they do not know pitfalls of the programming languages as well as idioms for doing things right. I guess a at least 4 year commitment is worth of serious consideration. I am 27 at this moment. If I take the offer, that implies I will be 31+ upon graduation. Wah... becoming.. what to say, no longer young. Hence, here I am seeking advice on whether it is good or not to take the PhD offer, and whether a CS PhD is good for my future career growth as a software engineer? I do not intent to go for academia.

    Read the article

  • How is this algorithm, for finding maximum path on a Directed Acyclical Graph, called?

    - by Martín Fixman
    Since some time, I'm using an algorithm that runs in complexity O(V + E) for finding maximum path on a Directed Acyclical Graph from point A to point B, that consists on doing a flood fill to find what nodes are accessible from note A, and how many "parents" (edges that come from other nodes) each node has. Then, I do a BFS but only "activating" a node when I already had used all its "parents". queue <int> a int paths[] ; //Number of paths that go to note i int edge[][] ; //Edges of a int mpath[] ; //max path from 0 to i (without counting the weight of i) int weight[] ; //weight of each node mpath[0] = 0 a.push(0) while not empty(a) for i in edge[a] paths[i] += 1 a.push(i) while not empty(a) for i in children[a] mpath[i] = max(mpath[i], mpath[a] + weight[a]) ; paths[i] -= 1 ; if path[i] = 0 a.push(i) ; Is there any special name for this algorithm? I told it to an Informatics professor, he just called it "Maximum Path on a DAG", but it doesn't sound good when you say "I solved the first problem with a Fenwick Tree, the second with Dijkstra, and the third with Maximum Path".

    Read the article

  • Having issues with initializing character array

    - by quandrum
    Ok, this is for homework about hashtables, but this is the simple stuff I thought I was able to do from earlier classes, and I'm tearing my hair out. The professor is not being responsive enough, so I thought I'd try here. We have a hashtable of stock objects.The stock objects are created like so: stock("IBM", "International Business Machines", 2573, date(date::MAY, 23, 1967)) my constructor looks like: stock::stock(char const * const symbol, char const * const name, int sharePrice, date priceDate): symbol(NULL), name(NULL), sharePrice(sharePrice), dateOfPrice(priceDate) { setSymbol(symbol); setName(name); } and setSymbol looks like this: (setName is indentical): void stock::setSymbol(const char* symbol) { if (this->symbol) delete [] this->symbol; this->symbol = new char[strlen(symbol)+1]; strcpy(this->symbol,symbol); } and it refuses to allocate on the line this->symbol = new char[strlen(symbol)+1]; with a std::bad_alloc. name and symbol are declared char * name; char * symbol; I feel like this is exactly how I've done it in previous code.I'm sure it's something silly with pointers. Can anyone help?

    Read the article

  • Structuring input of data for localStorage

    - by WmasterJ
    It is nice when there isn't a DB to maintain and users to authenticate. My professor has asked me to convert a recent research project of his that uses Bespin and calculates errors made by users in a code editor as part of his research. The goal is to convert from MySQL to using HTML5 localStorage completely. Doesn't seem so hard to do, even though digging in his code might take some time. Question: I need to store files and state (last placement of cursor and active file). I have already done so by implementing the recommendations in another stackoverflow thread. But would like your input considering how to structure the content to use. My current solution Hashmap like solution with javascript objects: files = {}; // later, saving files[fileName] = data; And then storing in localStorage using some recommendations localStorage.setObject(files): Currently I'm also considering using some type of numeric id. So that names can be changed without any hassle renaming the key in the hashmap. What is your opinion on the way it is solved and would you do it any differently?

    Read the article

  • What should be taught in a "Fundamentals of programming" course at university?

    - by Dervin Thunk
    I have started a new question (see here), because I think the topic is of importance in a more general form. The question is now: If you were a professor at a Computer Science Dept. in some university, what would make it into your course? This is a programming course, second term, first year computer science/computer engineering. Remember you have a limited amount of time, and students are of different levels of competence, and some may be scientists, but some will also go on to be programmers in companies of different kinds. You have to cater to all. Bonus: What language? (Although see this question for my current thoughts about this...) Maybe you want to attach a course outline from some university? See here for an even more general question about this. Answer: I can't really summarize this post... I guess it was too subjective. However, it looks like we have to cover the history of computing up to a certain extent, computer architecture (memory, registers, whatever), C, and finally some basic algos and data structures in a problem solving fashion. This will be the bare bones of the course. Thanks all. I will accept the most voted up answer to close the thread, as it should be done.

    Read the article

  • Java: Help constructing a fillTextFields() method

    - by Holly
    I have a Java project where I am to connect to a database and create buttons (next, new, save, delete, previous) to navigate through the database content where there are appropriate text fields and labels for the specific information. I'll use the code below as an example (each button is set up very similar)... I have it as follows: JButton jbtnNext = new JButton("Next ->"); jbtnNext.addActionListener(this); if (e.getSource() == jbtnNext) jbtnNext_Click(); private void jbtnNext_Click() { JOptionPane.showMessageDialog(null, "Next" ,"Button Pressed", JOptionPane.INFORMATION_MESSAGE); try { if (rset.next()) { fillTextFields(true); }else{ //Display result in a dialog box JOptionPane.showMessageDialog(null, "Not found"); } } catch (SQLException ex) { ex.printStackTrace(); } } The professor gave the following outline of logic to construct the fillTextFields() method: Construct the method to provide reusable code that would fill the JTextFields on the GUI with appropriate values from current record from the database (when "Previous or "Next" buttons are pressed) or blank values (when the new Button is pressed). To determine when the current record was to provide values (next and previous) or the value would be blank (new button) pass a boolean argument into the method. If data from the current record was to be used as fill values, pass true for both previous and next button code after moving the record pointer. If the new button was pressed and want to fill with blank values, pass false to the method. Inside the method, use a conditional expression to evaluate the boolean variable. If true, The appropriate get----() resultset method is used to fill the JTextFields. If false, fill them with "". The .setText() method of the JTextField is used to fill each JTextField. Make sure the fillTextFields method throws the appropriate exception. I understand and have the previous and next button methods passing true, while the new button method is passing false, but I don't quite understand how to set up the fillTextFields() method correctly or how to "throw the appropriate exception"... Any help would really be appreciated, thank you!

    Read the article

  • how to make a software and preserve database integrity and correctness and please help confused

    - by user287745
    i have made an application project in vs 08 c#, sql server from vs 08. the database has like 20 tables and many fields in each have made an interface for adding deleting editting and retrieving data according to predefined needs of the users. now i have to 1) make to project in to a software which i can deliver to professor. that is he can just double click the icon and the software simply starts. no vs 08 needed to start the debugging 2) the database will be on one powerful computer (dual core latest everything win xp) and the user will access it from another computer connected using LAN i am able to change the connection string to the shared database using vs 08/ debugger whenever the server changes but how am i supposed to do that when its a software? 3)there will by many clients am i supposed to give the same software to every one, so they all can connect to the database, how will the integrity and correctness of the database be maintained? i mean the db.mdf file will be in a folder which will be shared with read and write access. so its not necessary that only one user will write at a time. so is there any coding for this or? please help me out here i am stuck do not know what to do i have no practical experience, would appreciate all the help thank you

    Read the article

  • Choosing design method for ladder-like word game.

    - by owca
    I'm trying to build a simple application, with the finished program looking like this : I will also have to implement two different GUI layouts for this. Now I'm trying to figure out the best method to perform this task. My professor told me to introduce Element class with 4 states : - empty - invisible (used in GridLayout) - first letter - other letter I've thought about following solutions (by List I mean any sort of Collection) : 1. Element is a single letter, and each line is Element[]. Game class will be array of arrays Element[]. I guess that's the dumbest way, and the validation might be troublesome. 2. Like previously but Line is a List of Element. Game is an array of Lines. 3. Like previously but Game is a List of Lines. Which one should I choose ? Or maybe do you have better ideas ? What collection would be best if to use one ?

    Read the article

  • Regular expression, excluding .. in suffix of email addy

    - by user1754700
    This is homework, I've been working on it for a while, I've done lots of reading and feel I have gotten pretty familiar with regex for a beginner. I am trying to find a regular expression for validating/invalidating a list of emails. There are two addresses which are giving me problems, I can't get them both to validate the correct way at the same time. I've gone through a dozen different expressions that work for all the other emails on the list but I can't get those two at the same time. First, the addresses. [email protected] - invalid [email protected] - valid The part of my expression which validates the suffix I originally started with @.+\\.[[a-z]0-9]+ And had a second pattern for checking some more invalid addresses and checked the email against both patterns, one checked for validity the other invalidity but my professor said he wanted it all in on expression. @[[\\w]+\\.[\\w]+]+ or @[\\w]+\\.[\\w]+ I've tried it written many, many different ways but I'm pretty sure I was just using different syntax to express these two expressions. I know what I want it to do, I want it to match a character class of "character+"."character+"+ The plus sign being at least one. It works for the invalid class when I only allow the character class to repeat one time(and obviously the ip doesn't get matched), but when I allow the character class to repeat itself it matches the second period even thought it isn't preceded by a character. I don't understand why.

    Read the article

  • How do I make software that preserves database integrity and correctness? Please help, confused.

    - by user287745
    i have made an application project in vs 08 c#, sql server from vs 08. the database has like 20 tables and many fields in each have made an interface for adding deleting editting and retrieving data according to predefined needs of the users. now i have to 1) make to project in to a software which i can deliver to professor. that is he can just double click the icon and the software simply starts. no vs 08 needed to start the debugging 2) the database will be on one powerful computer (dual core latest everything win xp) and the user will access it from another computer connected using LAN i am able to change the connection string to the shared database using vs 08/ debugger whenever the server changes but how am i supposed to do that when its a software? 3)there will by many clients am i supposed to give the same software to every one, so they all can connect to the database, how will the integrity and correctness of the database be maintained? i mean the db.mdf file will be in a folder which will be shared with read and write access. so its not necessary that only one user will write at a time. so is there any coding for this or? please help me out here i am stuck do not know what to do i have no practical experience, would appreciate all the help thank you

    Read the article

  • BASH: How to count all the human readable files?

    - by user1687406
    I'm taking an intro course to UNIX and have a homework question that follows: How many files in the previous question are text files? A text file is any file containing human-readable content. (TRICK QUESTION. Run the file command on a file to see whether the file is a text file or a binary data file! If you simply count the number of files with the ".txt" extension you will get no points for this question.) The previous question simply asked how many regular files there were, which was easy to figure out by doing find . -type f | wc -l I'm just having trouble determining what "human readable content" is, since I'm assuming it means anything besides binary/assembly, but I thought that's what -type f displays. Maybe that's what the professor meant by saying "trick question"? This question has a follow up later that also asks "What text files contain the string "csc" in any mix of upper and lower case?". Obviously "text" is referring to more than just .txt files, but I need to figure out the first question to determine this!

    Read the article

  • Efficient Multiplication of Varying-Length #s [Conceptual]

    - by Milan Patel
    Write the pseudocode of an algorithm that takes in two arbitrary length numbers (provided as strings), and computes the product of these numbers. Use an efficient procedure for multiplication of large numbers of arbitrary length. Analyze the efficiency of your algorithm. I decided to take the (semi) easy way out and use the Russian Peasant Algorithm. It works like this: a * b = a/2 * 2b if a is even a * b = (a-1)/2 * 2b + a if a is odd My pseudocode is: rpa(x, y){ if x is 1 return y if x is even return rpa(x/2, 2y) if x is odd return rpa((x-1)/2, 2y) + y } I have 3 questions: Is this efficient for arbitrary length numbers? I implemented it in C and tried varying length numbers. The run-time in was near-instant in all cases so it's hard to tell empirically... Can I apply the Master's Theorem to understand the complexity...? a = # subproblems in recursion = 1 (max 1 recursive call across all states) n / b = size of each subproblem = n / 1 - b = 1 (problem doesn't change size...?) f(n^d) = work done outside recursive calls = 1 - d = 0 (the addition when a is odd) a = 1, b^d = 1, a = b^d - complexity is in n^d*log(n) = log(n) this makes sense logically since we are halving the problem at each step, right? What might my professor mean by providing arbitrary length numbers "as strings". Why do that? Many thanks in advance

    Read the article

  • solving problems recursively in C

    - by Harry86
    Our professor gave us the following assignment: A "correct" series is one inwhich the sum of its members equals to the index of its first member. The program is supposed to find the length of the LONGEST "correct" series within a series of n numbers. for example: if the input series would be arr[4]={1, 1, 0, 0} the output (longest "correct" series) would be 3. arr[0]=1. 0!=1 therefore the longest series here is 0. arr[1]=1,and 1=1. but the follwing members also sum up to 1 as shown below: 1=arr[1]+arr[2]+arr[3] = 1+ 0 + 0, therefore the longest series here is 3. the output in this example is 3. That's what I got so far: int solve(int arr[], int index, int length,int sum_so_far) { int maxwith,maxwithout; if(index==length) return 0; maxwith = 1+ solve(arr,index+1,length,sum_so_far+arr[index]); maxwithout = solve(arr,index+1,length,arr[index+1]); if(sum_so_far+arr[index]==index) if(maxwith>maxwithout) return maxwith; return maxwithout; return 0; } int longestIndex(int arr[], int index,int length) { return solve(arr,0,length,0); } What am I doing wrong here? Thanks a lot for your time... Harry

    Read the article

  • Java File Handling, what did I do wrong?

    - by Urda
    Wrote up a basic file handler for a Java Homework assignment, and when I got the assignment back I had some notes about failing to catch a few instances: Buffer from file could have been null. File was not found File stream wasn't closed Here is the block of code that is used for opening a file: /** * Create a Filestream, Buffer, and a String to store the Buffer. */ FileInputStream fin = null; BufferedReader buffRead = null; String loadedString = null; /** Try to open the file from user input */ try { fin = new FileInputStream(programPath + fileToParse); buffRead = new BufferedReader(new InputStreamReader(fin)); loadedString = buffRead.readLine(); fin.close(); } /** Catch the error if we can't open the file */ catch(IOException e) { System.err.println("CRITICAL: Unable to open text file!"); System.err.println("Exiting!"); System.exit(-1); } The one comment I had from him was that fin.close(); needed to be in a finally block, which I did not have at all. But I thought that the way I have created the try/catch it would have prevented an issue with the file not opening. Let me be clear on a few things: This is not for a current assignment (not trying to get someone to do my own work), I have already created my project and have been graded on it. I did not fully understand my Professor's reasoning myself. Finally, I do not have a lot of Java experience, so I was a little confused why my catch wasn't good enough.

    Read the article

  • Suitable data structures for saving files in localStorage (HTML5) ?

    - by WmasterJ
    It is nice when there isn't a DB to maintain and users to authenticate. My professor has asked me to convert a recent research project of his that uses Bespin and calculates errors made by users in a code editor as part of his research. The goal is to convert from MySQL to using HTML5 localStorage completely. Doesn't seem so hard to do, even though digging in his code might take some time. Question: I need to store files and state (last placement of cursor and active file). I have already done so by implementing the recommendations in another stackoverflow thread. But would like your input considering how to structure the content to use. My current solution Hashmap like solution with javascript objects: files = {}; // later, saving files[fileName] = data; And then storing in localStorage using some recommendations localStorage.setObject("files", files); // Note that setObject(key, data) does not exist but is added // using Storage.prototype.setObject = function() {... Currently I'm also considering using some type of numeric id. So that names can be changed without any hassle renaming the key in the hashmap. What is your opinion on the way it is solved and would you do it any differently?

    Read the article

  • C++ overloading comparative operators for a MyString class

    - by Taylor Gang
    bool operator == (const MyString& left, const MyString& right) { if(left.value == right.value) return true; else return false; } bool operator != (const MyString& left, const MyString& right) { if(left == right) return false; else return true; } bool operator < (const MyString& left, const MyString& right) { if(strcmp(left.value, right.value) == -1) return true; else return false; } bool operator > (const MyString& left, const MyString& right) { if(strcmp(left.value, right.value) == 1) return true; else return false; } bool operator <= (const MyString& left, const MyString& right) { if(strcmp(left.value, right.value) == -1 || strcmp(left.value, right.value) == 0) return true; else return false; } bool operator >= (const MyString& left, const MyString& right) { if(strcmp(left.value, right.value) == 1 || strcmp(left.value, right.value) == 0) return true; else return false; } So these are my implemented comparison operators for my MyString class, they fail the test program that my professor gave me and could use some direction. Thanks in advance for any and all help I receive.

    Read the article

  • C++: recursively computer all permutaions of digits 0 - 9

    - by Nate
    I have a homework assignment where part of the requirement is to recursively compute all the permutations of integers 0 - 9. The professor actually gave us the algorithm for this part of the question. I've finished the rest of the assignment, but I can't get the permute function working...I'm implementing it exactly like it was shown on the assignment information. However, when I run it each permutation is repeated multiple times (and I'm not sure if I'm even getting all the correct permutations.) I think he must've made a mistake on the assignment instructions. I've been working on this for a couple of hours and can't seem to figure out where I'm going wrong. Can anybody help point me in the right direction? Here's the current code: void permute(int v[], int curr) { for (int i = curr; i < MAX; i++) { swap(v[i], v[curr]); permute(v, curr + 1); swap(v[curr], v[i]); } } EDIT: Actually, right after posting this I realized it has to do with the swap, right? Because right now i and curr are the same, so I'm swapping identical numbers. Hm, should it be swap(v[i], v[curr+1])?

    Read the article

  • Basic SQL Query, I am newbie

    - by user3530547
    I just started my database and query class on Monday. We met on Monday and just went over the syllabus, and on Wednesday the network at school was down so we couldn't even do the power point lecture. Right now I am working on my first homework assignment and I am almost finished but I am having trouble on one question. Here is is... Write a SELECT statement that returns one column from the Customers table named FullName that joins the LastName and FirstName columns. Format the columns with the last name, a comma, a space, and the first name like this: Doe, John Sort the result set by last name in ascending sequence. Return only the contacts whose last name begins with letters from M to Z. Here is what I have so far... USE md0577283 SELECT FirstName,LastName FROM Customers ORDER BY LastName,FirstName My question is how do I format is Lastname, FirstName like the professor wants and how do I only select names M-Z? If someone could point me in the right direction I would greatly appreciate it. Thank you. PS With all do respect, I didn't ask for the answer I asked for a nudge in the right direction so why the down vote guys?

    Read the article

< Previous Page | 3 4 5 6 7 8 9  | Next Page >