Recent content by mr.me

  1. M

    Comp Sci Next Perfect Squares for a Given Number

    As an aside, i.e. not homework, what if I wanted to write a square root function, that we allow you to set the given decimal points for stuff like the square of 7 or the square of 10.? I know C++ already has a sqrt function but could I use my code, clumsy though it may be or would I have to...
  2. M

    Comp Sci Next Perfect Squares for a Given Number

    Thank-you, I see what I was doing wrong. We are required to use each std:: for our work, instead of loading the whole namespace. Thanks again :smile:
  3. M

    Comp Sci Next Perfect Squares for a Given Number

    I guess that was an obvious mistake :-p Still I am not sure how to construct my loop for the problem in question With the second loop I wanted to check each iteration until a got a value less-than the user entered value... So if I entered 6 I wanted it to return a 4 because that is the...
  4. M

    Comp Sci Next Perfect Squares for a Given Number

    Heres my problem, step one I've solved. Step two only ever returns the original newRoot*newRoo and I don't understand how to correct itTo demonstrate event controlled loops use arithmetic to create: 1.Create a sequence to determine the next largest perfect square 2.Create another sequence to...
  5. M

    Comp Sci C++ identifying a palindrome (output error)

    Thanks I never got an error message and couldn't get it to run proper so it tried using a different compiler and fixed the error .
  6. M

    Comp Sci C++ identifying a palindrome (output error)

    I had a homework assignment that wanted me to write a function that would determine whether a five digit integer was a palindrome or not When I run the program I enter the palindrome there is no output for my if/else statement. What did I do wrong? Code Below #include <iostream> using...
  7. M

    Python Save Output of Python Program to TXT File: Tips & Tricks

    This isn't exactly part of my homework but I wanted to know how I could save the output of this program to txt file? The program was my homework and it was to allow the user to enter the starting values for a multiplication tables columns and rows and print a 10x10table I did it like so...
  8. M

    Humanities: What are the more important things to know?

    You seem to say that your problem is that your completely unfamiliar with subjects in a formal way. I would suggest starting with something slightly less contemporary then you find at the bookstore. Will Durant wrote extensively and in a large scope on the Humanities, though I disagree with...
  9. M

    Printing a multipication table from user input

    My assignment was to "create a Python script that will allow the user to input the starting value for the row and column of a multiplication table and then print to screen the table containing ten columns and ten rows. Include a header for each row and column" I was able to produce the...
  10. M

    Bubble sort doesn't stop as expected

    It does seem to work on several tests, however I changed it and noticed no difference
  11. M

    Bubble sort doesn't stop as expected

    It sorted several lists of many elements, correctly def bubbleSort (theList): size = len(theList) - 1 while (0<size): #Corrected the condition for the first while #it is now set to perform from a range of 0...
  12. M

    Bubble sort doesn't stop as expected

    I think I got it, half the time the problem I was having was that in my text editor my print statement was set outside the function and always displayed unsorted, I don't know why it copied correctly here, so even when I made (several tries) the first loop while(0<size) it wasn't working...
  13. M

    Bubble sort doesn't stop as expected

    I tried it on a longer list, and it's obviously I don't understand what I'm doing, can you show me a correct way to do it, I don't mean to just ask for the answer but I don't understand what the problem is anymore and now I'm more confused
  14. M

    Bubble sort doesn't stop as expected

    Yes, it works and exists. I fixed an indent on the post that might have made it look wrong I guess what I was asking is in languages where it is necessary to write a sort like this, is the code stylistically correct. Again, thanks for all the help.
  15. M

    Bubble sort doesn't stop as expected

    Is this correct ? def bubbleSort (theList): size = len(theList) - 1 while (size > 0): index = 0 while ( index>size ): if (theList[index] > theList[index+1]): temp = theList[index] theList[index] = theList[index+1]...
Back
Top