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 8205695
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T08:21:27+00:00 2026-06-07T08:21:27+00:00

How can i test a c++ program with given input test cases? For example

  • 0

How can i test a c++ program with given input test cases?

For example an input like this

23 45 78 45 12 67 23 76 56 34
34 65 78 45 74 3  98 34 23 97

I want to be able to input these numbers from a text file into a program at run-time and test expected output. I cannot input thousands of numbers by hand in a console so are there any softwares that allow these kind of testing?

This is already being used in InterviewStreet, they use given test cases and match the expected output to test a program.

–Edit–

Is there any way i can pass values from a text file into stdin ?

  • 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-07T08:21:28+00:00Added an answer on June 7, 2026 at 8:21 am

    You could write a little bash script to run all of your tests. An individual test would look something like this:

    #!/bin/bash
    testprog < input1.txt > output1.txt
    diff expected_output1.txt output1.txt
    # examine the return code of diff to see if the files are different?
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This program produces the output I expect when given an input file of text
Suppose , i have some x test-cases to be read from input, where each
The MSDN docs state that I can find the WCF Test Client in: C:\Program
Is there any virtual machine to test Android? How can I debug the program
How can this test fail? [TestMethod] public void Get_Code() { var expected = new
I have to test a program which takes one input file. I have put
I am trying to write a Labview program that takes input from a thermal
I was given the following HomeWork assignment, Write a program to test on your
I have a program, using pyserial, and I want to test it without using
I am trying to create a program which, given an input file, returns the

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.