-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestreader.cpp
More file actions
63 lines (58 loc) · 1.2 KB
/
testreader.cpp
File metadata and controls
63 lines (58 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#include "Ref.h"
#include "Verse.h"
#include "Bible.h"
#include <iostream>
#include <fstream>
#include <string>
#include <stdio.h>
#include <stdlib.h>
using namespace std;
int main(int argc, char** argv) {
// Create Bible object to process the raw text file
Bible webBible("/home/class/csc3004/Bibles/web-complete");
Verse verse;
int b, c, v, n;
LookupResult result;
if (argc == 1) {
cout << "Error: everything is missing" << endl;
return 34;
}
else if (argc == 2) {
cout << "Error: chapter and verse number are missing" << endl;
return 34;
}
else if (argc == 3) {
cout << "Error: verse number is missing" << endl;
return 34;
}
else if (argc > 5) {
cerr << "Error: too many arguments" << endl;
return 34;
}
b = stoi(argv[1]);
c = stoi(argv[2]);
v = stoi(argv[3]);
n = 1;
if (argc > 4) {
n = stoi(argv[4]);
}
Ref ref(b, c, v);
verse = webBible.lookup(ref, result);
if (webBible.error(result) != "") {}
else {
verse.displayCL();
if (argc > 4) {
if (n > 0) {
for (int i = 1; i < n; i++) {
Verse verseNext = webBible.nextVerse(result);
cout << endl;
verseNext.displayCL();
if (result != SUCCESS) {
break;
}
}
}
}
cout << endl;
}
}