Question

I have a c++ program that needs command line arguments like this

./Program textfile.txt argu1 10 

It then gives an output on command line, using cout.

However, is there an easy way of inputting

./Program textfile.txt argu1 10 
./Program textfile.txt argu1 20 
./Program textfile.txt argu1 30 

I need the output in a text file because I need to run 100 of these.

I rather not do it manual...

Was it helpful?

Solution

If you are working in bash shell, you can use:

for i in $(seq 10 10 1000)
do
  ./Program textfile.txt $i >> ouitput.txt
done
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top