vividexstance's Profile User Rating: *****

Reputation: 699 Enlightened
Group:
Expert
Active Posts:
2,418 (1.62 per day)
Joined:
31-December 10
Profile Views:
13,390
Last Active:
User is online A minute ago
Currently:
Viewing Forum: C and C++

Previous Fields

Country:
Who Cares
OS Preference:
Who Cares
Favorite Browser:
Who Cares
Favorite Processor:
Who Cares
Favorite Gaming Platform:
Who Cares
Your Car:
Who Cares
Dream Kudos:
0
Expert In:
C/C++

Latest Visitors

Icon   vividexstance has not set their status

Posts I've Made

  1. In Topic: C++ Final output needs to print initial values and final values

    Posted 28 Jan 2015

    The code you posted really doesn't do anything except for print 6 uninitialized character variables.

    Where do you open the text file and read from it? Using strings sounds like it would be easier than using 6 individual characters, especially if you want to scale the program up to more characters at a later date.

    You can write your own swap function or use the one from the standard C++ library. If you proceed to use individual character variables, the swapping isn't difficult. You would just need 3 swap calls.

    Then you need to get the adjusted value from the user. Once you have this number, you can manually add it to each character variable.

    If you want to save the original values, then either use 2 strings, or 12 character variables (6 for the original and 6 for the "encoded" characters).
  2. In Topic: C Program to compare two text files

    Posted 28 Jan 2015

    Your original post said you needed to compare the differences between the lines and columns of two different text files.

    The code you just posted is reading in up to 1000 characters and comparing what is read in.

    From the program description, it sounds like you're going to need to design some functions to handle the different aspects of the program. For example, you could write a function that reads a line from a file. Then you could write a function that compares two given strings and displays the difference (if any).

    When writing these functions, have each function perform one task and one task only. If your function starts getting long, you may want to consider breaking it down into separate functions.

    When you see code being repeated, maybe with just minor changes in it, you definitely should consider making the repeated code into a function, with the minor differences as arguments.

    By breaking up the program into functions, it makes it much easier to test and debug. You simply write a function, and you can write a small "driver" or test program to test that one function. Once you feel the function works and is bug free, you go on to the next function.

    Once you have all the functions you need, its simply a matter of calling them in the appropriate spots in the main() function.
  3. In Topic: C Program to compare two text files

    Posted 28 Jan 2015

    View Postsidifaissal, on 28 January 2015 - 06:36 AM, said:

    i dont know how to start or what to do with this, please anyhelp :)/>

    This is not very helpful to us.

    What about the program's description are you having trouble understanding?
  4. In Topic: Common elements of two Arrays c++ help

    Posted 23 Jan 2015

    I think your best bet is too start over. I already said to forget about your original function. Put the code for the algorithm I showed you in that function or a similar one and use that instead of putting it in main().
  5. In Topic: Common elements of two Arrays c++ help

    Posted 23 Jan 2015

    Could you post a complete program please, its hard to tell where things go wrong without the whole picture?

    Also, I recommend using a regular while loop instead of a do-while, they can be tricky for beginners.

    EDIT:
    With the algorithm I posted, simply write another function, don't try to put it in with your other function.

My Information

Member Title:
D.I.C Lover
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:

Contact Information

E-mail:
Click here to e-mail me

Comments

Page 1 of 1
  1. Photo

    orihotomihsah Icon

    09 Sep 2013 - 09:45
    Hi
Page 1 of 1