Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8715369
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T05:49:35+00:00 2026-06-13T05:49:35+00:00

Im trying to write up a code where two txt files are being compared

  • 0

Im trying to write up a code where two txt files are being compared to each other. One text files has the answer like “TFTTFFT” and the other txt files has the result including id like “1234 TT-FFT” The crazy part is that for each correct answer, the student gets 4 points and for every incorrect answer, the student gets -1 and for every no answer, which in this case is represented by a dash(-), the student gets zero. How do i go about writing up a code for this? ANy help will be very much appreciated. I don’t necessarily need some one to code this for me as i have pretty much done the opening of files and storing them in appropriate variables. Just a feed back on how to go about doing this would be nice. Thank you in advance.

Update :
I have revised the whole code and will put it up for consideration. Thank you Josh and thank you all those who have contributed so far. Please do let me know further what you guys think of the revised coding.

Update : Program not working 🙁

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T05:49:37+00:00Added an answer on June 13, 2026 at 5:49 am
        Dim answers As String = 'Text from the answor file
        Dim student As String = 'Text from the student file
    
        ' a will be used to hold the first char from the answers file
        ' s will be used to hold the first char from the student file
        Dim a As String
        Dim s As String
    
        ' veriable that holds the student grad
        Dim grade As Integer = 0
    
        ' loop while we still have an answer
        While answers.Length > 0
    
            ' get the first answer and student respond
            a = answers.First
            s = student.First
    
            ' compare the two and update the student grade accourdingly
            If a = "-" Then
                grade = grade - 1
    
            ElseIf a = s Then
                grade = grade + 4
            Else
                grade = grade - 1
            End If
    
            ' remove the first answer from the two strings
            answers = answers.Substring(1)
            student = student.Substring(1)
        End While
    
    
        return grade
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to write code that spawns two child processes that send each other
I have two text files. hash_only.txt and final_output.txt hash_only.txt looks like below. 193548 401125
I'm learning python and trying to write a code to sync two directories: one
I'm trying to create a JavaServer Page that reads in two text files (dev.txt
I'm trying to write a piece of code that takes in a two digit
I am trying to write a program that has twenty five buttons, when one
Trying to write a piece of code to compare two strings. If either are
I am trying to write a code that compares two strings and return the
I am trying to write a code generator do to Mapping between any two
I'm trying to write some Java code for a set of enum classes. Each

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.