mirror of
https://github.com/Comp211-SP24/lab-01-Rushilwiz.git
synced 2025-04-21 11:30:18 -04:00
finished lab
This commit is contained in:
parent
d9d4568e99
commit
39538d8cbb
|
@ -1 +1 @@
|
||||||
tar heels
|
tar heelsbruh
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
awk '/^cd/' $HISTFILE | wc -l
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
diff <(./lower < test0.txt) test0-result.txt
|
||||||
|
|
BIN
3-truncator/truncator
Executable file
BIN
3-truncator/truncator
Executable file
Binary file not shown.
|
@ -1,2 +1,44 @@
|
||||||
// PID: 9DigitPidNoSpacesOrDashes
|
// PID: 730677144
|
||||||
// I pledge the COMP 211 honor code.
|
// I pledge the COMP 211 honor code.
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
int lines[100];
|
||||||
|
int total, chars, cur, c;
|
||||||
|
|
||||||
|
total = 0;
|
||||||
|
chars = 0;
|
||||||
|
cur = 0;
|
||||||
|
|
||||||
|
while ((c = getchar()) != EOF) {
|
||||||
|
chars++;
|
||||||
|
|
||||||
|
if (c == '\n') {
|
||||||
|
chars = 0;
|
||||||
|
cur++;
|
||||||
|
putchar(c);
|
||||||
|
} else if (chars > 50) {
|
||||||
|
if (total == 0 || lines[total-1] != cur) {
|
||||||
|
lines[total] = cur;
|
||||||
|
total++;
|
||||||
|
}
|
||||||
|
|
||||||
|
chars = 1;
|
||||||
|
putchar('\n');
|
||||||
|
putchar(c);
|
||||||
|
} else {
|
||||||
|
putchar(c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("Total lines over 50 chars: %d\n", total);
|
||||||
|
printf("Offending lines: ");
|
||||||
|
for (int i = 0; i < total; i++) {
|
||||||
|
printf("%d, ", lines[i]);
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user