Hi nahla,
Please post your compiler output in full
Your solution seems to be a mix of C and C++. Try to move towards the C++ way of doing things.
Here is a tutorial on argc argv:
In there you will see that argc is always at least 1.
1 2
|
for(int i = 0; i < argc; i++);
argc <= 3;
| |
You have a semiclon after the for loop, which isn't needed. That draws a warning from my compiler.
the next line doesn't make sense - did you mean an if statement?
Lines 17 & 18 happen before any error testing of the arguments is done. What if no args were given?
Line 26 is a nightmare and not scalable - what if there were 20 files? Much better to do this with a switch statement.
LIne 64: If you are using C++, you can use C++ strings, rather than than the C approach of array of char,
C++ strings are handy - you can compare them directly with == . So no need to use the C function strcmp.
Line 49: this will not work because the variables are arrays of char not strings.
When you open files, check that it worked - don't just assume that it does. Programming is all about thinking "What can go wrong" and providing code to minimise problems.
I look forward to helping out further. :)