Question
Hi I need help to fix my C++ file. I'm testing wzip.cpp on my terminal . I'm testing shell file you know .sh to run
Hi I need help to fix my C++ file. I'm testing wzip.cpp on my terminal . I'm testing shell file you know .sh to run my c++ file but it failed the test. Here is the screenshot below of what's happening. I need you to fix the c++ file to pass the test. On top unzip.cpp is passing all test but wzip is not working
////////// here is the file wzip.cpp
#include
#include
using namespace std;
int main(int argc, char* argv[]) {
char currentC, previousC;
int count = 1,stop =1;
if(argc == 1){
cout
return 1;
}
for(int i =1;i
ifstream myFile (argv[i]); // open file in read mode
if (myFile.is_open()) {
if(!myFile.eof()){
myFile.get(previousC);
while(!myFile.eof()){
myFile.get(currentC);
if(currentC == previousC) count++;
else {
cout
previousC = currentC;
count =1;
}
} //end of while
cout
} // end of if (myFile.eof())
myFile.close();
} // end of for loop
else {
cout
return 1;
}
}
return 0;
}
test tests wunzip tonmoy@Tonmoys-MacBook-Air wunzip % g++ wunzip.cpp - wunzip tonmoy@Tonmoys-MacBook Air wunzip % ./test-wunzip.sh Te[32mtest 1: passed\e[@m Te[32mtest 2: passed\e[@m e [32mtest 3: passed e[Om e[32mtest 4: passed\e[Om Te[32mtest 5: passed\e[@m Te[32mtest 6: passed\e[@m tonmoy@Tonmoys-MacBook-Air wunzip % cd /Users/tonmoy/Documents/3207/Labton/projecto-tests/wzip tonmoy@Tonmoys-MacBook-Air wzip % ls test-wzip.sh tests tests-out wzip wzip.cpp tonmoy@Tonmoys-MacBook-Airwzip % g++ wzip.cpp -o wzip tonmoy@Tonmoys-MacBook-Air wzip % ./test-wzip.sh ./test-wzip.sh: line 2: aaaaaaaaaabbbb: command not found Te[31mtest 1: out incorrect\e[@m what results should be found in file: tests/1.out what results produced by your program: tests-out/1.out compare the two using diff, cmp, or related tools to debug, e.g. prompt> diff tests/1.out tests-out/1.out, tonmoy@Tonmoys-MacBook Air wzip % -C zsh: command not found: -c tonmoy@Tonmoys-MacBook Air wzip % ./test-wzip.sh -C ./test-wzip.sh: line 2: aaaaaaaaaabbbb: command not found Te[31mtest 1: out incorrect\e[m what results should be found in file: tests/1.out what results produced by your program: tests-out/1.out compare the two using diffcmp, or related tools to debug, e.g. prompt> diff tests/1.out tests-out/1.out, e[31mtest 2: out incorrectle[Om what results should be found in file: tests/2.out what results produced by your program: tests-out/2.out compare the two using diff, cmp, or related tools to debug, e.g. prompt> diff tests/2.out tests-out/2.out e [32mtest 3: passed e[Om e[31mtest 4: out incorrectle[Om what results should be found in file: tests/4.out what results produced by your program: tests-out/4.out, compare the two using diffcmp, or related tools to debug, e.g.: prompt> diff tests/4.out tests-out/4.out Te[31mtest 5: out incorrect\e[@m what results should be found in file: tests/5.out what results produced by your program: tests-out/5.out compare the two using diff, cmp, or related tools to debug, e.g.: prompt> diff tests/5.out tests-out/5.out, e[31mtest 6: out incorrectle[@m what results should be found in file: tests/6.out what results produced by your program: tests-out/6.out compare the two using diff, cmp, or related tools to debug, e.g.: prompt> diff tests/6.out tests-out/6.out tonmoy@Tonmoys-MacBook-Air wzip % test tests wunzip tonmoy@Tonmoys-MacBook-Air wunzip % g++ wunzip.cpp - wunzip tonmoy@Tonmoys-MacBook Air wunzip % ./test-wunzip.sh Te[32mtest 1: passed\e[@m Te[32mtest 2: passed\e[@m e [32mtest 3: passed e[Om e[32mtest 4: passed\e[Om Te[32mtest 5: passed\e[@m Te[32mtest 6: passed\e[@m tonmoy@Tonmoys-MacBook-Air wunzip % cd /Users/tonmoy/Documents/3207/Labton/projecto-tests/wzip tonmoy@Tonmoys-MacBook-Air wzip % ls test-wzip.sh tests tests-out wzip wzip.cpp tonmoy@Tonmoys-MacBook-Airwzip % g++ wzip.cpp -o wzip tonmoy@Tonmoys-MacBook-Air wzip % ./test-wzip.sh ./test-wzip.sh: line 2: aaaaaaaaaabbbb: command not found Te[31mtest 1: out incorrect\e[@m what results should be found in file: tests/1.out what results produced by your program: tests-out/1.out compare the two using diff, cmp, or related tools to debug, e.g. prompt> diff tests/1.out tests-out/1.out, tonmoy@Tonmoys-MacBook Air wzip % -C zsh: command not found: -c tonmoy@Tonmoys-MacBook Air wzip % ./test-wzip.sh -C ./test-wzip.sh: line 2: aaaaaaaaaabbbb: command not found Te[31mtest 1: out incorrect\e[m what results should be found in file: tests/1.out what results produced by your program: tests-out/1.out compare the two using diffcmp, or related tools to debug, e.g. prompt> diff tests/1.out tests-out/1.out, e[31mtest 2: out incorrectle[Om what results should be found in file: tests/2.out what results produced by your program: tests-out/2.out compare the two using diff, cmp, or related tools to debug, e.g. prompt> diff tests/2.out tests-out/2.out e [32mtest 3: passed e[Om e[31mtest 4: out incorrectle[Om what results should be found in file: tests/4.out what results produced by your program: tests-out/4.out, compare the two using diffcmp, or related tools to debug, e.g.: prompt> diff tests/4.out tests-out/4.out Te[31mtest 5: out incorrect\e[@m what results should be found in file: tests/5.out what results produced by your program: tests-out/5.out compare the two using diff, cmp, or related tools to debug, e.g.: prompt> diff tests/5.out tests-out/5.out, e[31mtest 6: out incorrectle[@m what results should be found in file: tests/6.out what results produced by your program: tests-out/6.out compare the two using diff, cmp, or related tools to debug, e.g.: prompt> diff tests/6.out tests-out/6.out tonmoy@Tonmoys-MacBook-Air wzip %Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started