• Member Avatar for David W
    David W

    Replied To a Post in Greatest Common Factor of Many Numbers

    Hint ... Try finding prime factors of each number, then, gather up (multiply) all the common primes.
  • Member Avatar for David W
    David W

    Replied To a Post in Write a program that merges the numbers in two files and writes...

    The example that I mentioned that you would like to see ... // input1.txt /* 1 2 3 4 4 5 6 7 7 7 8 9 10 20 25 …
  • Member Avatar for David W
    David W

    Replied To a Post in As a beginner, what IDE should I use?

    > Just make a text editor and incorporate the interpreter. What about the GUI? ( A text editer too ? Recall ... a cool project for just beginners :)
  • Member Avatar for David W
    David W

    Replied To a Post in Python Help!

    > > Hey ... sorry I missed that ... is that why you 'down-voted' ? > It was not me as downvoted you :) Sorry ... anyways ... it's good …
  • Member Avatar for David W
    David W

    Began Watching Values read from vector unexpectedly different within the same function.

    I am trying to create a tennis tournament simulator. There are 128 players in the tournament, and 32 seeds. I have a vector filled with 'Player' objects named 'Players'. Each …
  • Member Avatar for David W
    David W

    Replied To a Post in Values read from vector unexpectedly different within the same function.

    This, (to me), seems to be a much simpler 'first go' ... and a possibly more efficent re-design .... (that yields sets of Playoff Players all ready initialed in a …
  • Member Avatar for David W
    David W

    Gave Reputation to rakesh.malakar.77 in A Simple Tic Tac Toe: C Programming

    i was just scrolling down the page to check where the coding ends....mannn!! got to appreciate ur effort....
  • Member Avatar for David W
    David W

    Replied To a Post in As a beginner, what IDE should I use?

    > Just write your own with python like normal programmars do, it the pythonic approach. Yep ... a really cool 'beginner' project :)
  • Member Avatar for David W
    David W

    Began Watching Split lists based on user input in Python

    Hello! So, I'm taking some classes and learning how to write sample programs in Python, and I've stalled out pretty hard on one of the sample programs. The current exercise …
  • Member Avatar for David W
    David W

    Replied To a Post in Split lists based on user input in Python

    And then ... perhaps next step ... 'revise code to crash proof input' ... i.e. to accept only valid user input: # takeInHousePrices.py # def takeInInt( msg, low, high ): …
  • Member Avatar for David W
    David W

    Replied To a Post in Python Help!

    > Dont use file as a variable name,file is a reserved word used bye Python. Hey ... sorry I missed that ... is that why you 'down-voted' ?
  • Member Avatar for David W
    David W

    Began Watching Python Help!

    Hello, I am trying to create a function that will search a fixed line of text for a word or phrase. Once that is completed, I am to try and …
  • Member Avatar for David W
    David W

    Replied To a Post in Python Help!

    You may like to see this demo (modify to suit your needs): import os def search_linetest(): path = 'C:/Users/dwzavitz/Desktop/2014Files/DaniPython' #'/Users/jolie_tia/Documents' dir = os.listdir(path) for file in dir: print( file ) …
  • Member Avatar for David W
    David W

    Replied To a Post in Write a program that merges the numbers in two files and writes...

    Don't forget to handle 'all' the cases ... including if either of the input files is empty. This can actually be a little tricky to handle. You may like, while …
  • Member Avatar for David W
    David W

    Began Watching Write a program that merges the numbers in two files and writes...

    Hey guys, I need help with another one of those I/O File coding. I am super clueless and this is what I have so far: /*Write a program that merges …
  • Member Avatar for David W
    David W

    Replied To a Post in Write a program that merges the numbers in two files and writes...

    Your desired main function (with the merge file function) could look something like this: int main() { ifstream fin1("input1.txt"); ifstream fin2("input2.txt"); ofstream fout("output.txt"); if( fin1 && fin2 && fout ) …
  • Member Avatar for David W
    David W

    Replied To a Post in C++ Game Lottery Problem

    Take a look at this little demo ... #include <iostream> // re comparing two arrays to see if hold 'equal' items ... // #include <vector> #include <algorithm> // re. vector …
  • Member Avatar for David W
    David W

    Replied To a Post in C++ Compute average word length for a file that contains some text...

    One 'quick way' that comes to mind ... // countCharsWords2.cpp // #include <iostream> #include <iomanip> #include <fstream> #include <string> using namespace std; // can easily change FNAME here ... // …
  • Member Avatar for David W
    David W

    Replied To a Post in How to read an .txt file and turn each line into a ARRAY

    Here is a little demo of using a 'C vector' (Cvec), (here using ... a readily expandable dynamic array of dynamic C strings, to handle a problem of reading in …
  • Member Avatar for David W
    David W

    Began Watching How to read an .txt file and turn each line into a ARRAY

    Hello guys, i have an .txt file like this -- Brasil Portugal Chile Espanha -- And i have to read this and put it in a array, i've been looking …
  • Member Avatar for David W
    David W

    Replied To a Post in How to read an .txt file and turn each line into a ARRAY

    * Do you know how to read a (.txt) file in C? * You could use an extra large array of C strings (Or use dynamic memory ... and a …
  • Member Avatar for David W
    David W

    Began Watching for loops and pattern

    we were given a task to create a for loop with where the user gives a number and became this output and we dont know if there is a sequence …
  • Member Avatar for David W
    David W

    Replied To a Post in for loops and pattern

    Do you have examples of output for input of 1 and 2? (Or is the first valid input 3?)
  • Member Avatar for David W
    David W

    Replied To a Post in C++ Compute average word length for a file that contains some text...

    If you took what I gave you above as a start ... you might have coded something like the following: // countCharsWords.cpp // #include <iostream> #include <iomanip> #include <fstream> #include …
  • Member Avatar for David W
    David W

    Began Watching writing a program that allow replacement of the first character, loops/stri

    any suggestions on how to repalce the specific character with a different character within the string while running a loop? I am in a no prereq class and am not …
  • Member Avatar for David W
    David W

    Replied To a Post in writing a program that allow replacement of the first character, loops/stri

    > any suggestions on how to replace the specific character with a different character within the string while running a loop? I am in a no prereq class and am …
  • Member Avatar for David W
    David W

    Began Watching C++ Game Lottery Problem

    Hello Guys Well I'm working on a lottery game and I would like to ask something because I don't know how to test the sequence of numbers before to print …
  • Member Avatar for David W
    David W

    Replied To a Post in C++ Game Lottery Problem

    You could make a copy of the series of numbers, then sort the copies, and then compare the sorted series to see if the same.
  • Member Avatar for David W
    David W

    Began Watching C++ Compute average word length for a file that contains some text...

    Hey people! Can you please help me with this problem? I am so stuck on it and my instructor gave me hints on what I should do. No arrays or …
  • Member Avatar for David W
    David W

    Replied To a Post in C++ Compute average word length for a file that contains some text...

    Why not use C++ string since you are using C++ ... and something like below ... ifstream fin( fnameCppStr.c_str() ); if( fin ) { int numWords = 0, numChars = …
  • Member Avatar for David W
    David W

    Began Watching As a beginner, what IDE should I use?

    I only started learning Python a few days ago, so as a beginner, what IDE should I be using? Should I just start with IDLE, then move on to something …
  • Member Avatar for David W
    David W

    Replied To a Post in As a beginner, what IDE should I use?

    'IDLE' is always an easy ... (and free) way to start coding in Python :)
  • Member Avatar for David W
    David W

    Began Watching Question from a beginner learning Python

    I am new here and it's my first post, so I'm sorry if this is in the wrong place or is formatted wrong. I made my first Python code, which …
  • Member Avatar for David W
    David W

    Replied To a Post in Question from a beginner learning Python

    You might also like to see this Python 3... example: (that uses a function to loop until valid integer input) (and that loops to ask user if more numbers to …
  • Member Avatar for David W
    David W

    Began Watching Parsing an equation

    I'm trying to parse equations like these which only has two values or the square root of a certain value from a text file: 100+100 -100-100 -(100)+(-100) sqrt(100) by the …
  • Member Avatar for David W
    David W

    Replied To a Post in Parsing an equation

    100+100 -100-100 -(100)+(-100) sqrt(100) The last line above could be tested / handled by: if "sqrt(" then if int then if ")" then process ... The next to last line …
  • Member Avatar for David W
    David W

    Replied To a Post in default constructor

    @Akash_Soni Your reply is true ... in the case where your design actually does call (i.e. the program uses it) the default ctor ... other-wise (sometimes) ... you may not …
  • Member Avatar for David W
    David W

    Began Watching Capture user input into array

    Is it possible to dynamically use scanf to prompt for user input ? I have the code shown below scanf("%d %d %d %d", &myarray[row][0], &myarray[row][1], &myarray[row][2], &myarray[row][3]) which works fine …
  • Member Avatar for David W
    David W

    Replied To a Post in Capture user input into array

    You could loop until all input was exhasted putting each next element into the next spot in the array on each loop and yes ... you can also dynamically allocate …
  • Member Avatar for David W
    David W

    Began Watching recursion in c

    how can you write a program that returns the last integer of the inputted number from the keyboard by the user using recursion?
  • Member Avatar for David W
    David W

    Replied To a Post in recursion in c

    Recursion can be tricky ... especially when you first try it ... so look up lots of examples where recursion is used. For a popular example, see 'quick sort' The …
  • Member Avatar for David W
    David W

    Began Watching default constructor

    Can we create an array of objects for a class having default constructor?. Justify your answer.
  • Member Avatar for David W
    David W

    Replied To a Post in default constructor

    > We can create an array of objects for any class , irrespective of *whether it has a default constructor or not* Is the above really true? Please see ... …
  • Member Avatar for David W
    David W

    Replied To a Post in Would You Please Help Me ?

    Also @Avishek_1 ... Please note that in standard C++ (and C) it is int main ( NOT void main ) i.e. main returns an int
  • Member Avatar for David W
    David W

    Began Watching Would You Please Help Me ?

    Hello every one . . recently i have written this code to count letters and words in the phrase that the user enter , it worked once but when deleted …
  • Member Avatar for David W
    David W

    Replied To a Post in Would You Please Help Me ?

    @Avishek_1 NOT good to use gets ... NOR to revert to old style C++ and mix up OP using stdio.h when OP was using C++ <iostream> Also since OP using …
  • Member Avatar for David W
    David W

    Began Watching Help Please :(

    Can Someone help me to Create a program that receives a character and returns true if a character is a VOWEL and false otherwise.
  • Member Avatar for David W
    David W

    Replied To a Post in Help Please :(

    This may get you started ... // function to return true if char c // passed in is a vowel ... // otherwise to return false bool isVowel( char c …
  • Member Avatar for David W
    David W

    Replied To a Post in C++ saving and reading (fairly simple)

    ok ... could try (to start) something like... fileName = "david_w.txt" #intLevelNum intSecsLeft short text info re player 1 120 newbie 1 30 2 120 2 30 2 120 2 …
  • Member Avatar for David W
    David W

    Began Watching C++ saving and reading (fairly simple)

    **Question 1:** I want to create a save file for a game im creating in C++ problem is i can only use the vanilla headers in dev-cpp (which spawns another …

The End.