a gleam implementation of a CS assignment originally written in cpp
1/********************************************************* 2* Summary: find verses from the old testament 3* appending them to file as found 4* 5* Author: Kieran Klukas 6* Created: October 2025 7* 8********************************************************/ 9 10#include <iostream> 11#include <cstdlib> 12#include <fstream> 13 14using namespace std; 15 16int main(int argc, char **argv) { 17 18 ifstream OT; 19 string filename = "../test/OT.txt"; 20 string book; 21 int chapter; 22 int verse; 23 24 // get path to OT.txt if provided otherwise use default path 25 if (argc == 2) { 26 filename = argv[1]; 27 } 28 29 OT.open(filename); 30 31 if (!OT.is_open()) { 32 cout << filename << ": failed to open file"; 33 return 1; 34 } 35 36 cout << "Please enter the reference of the verse you would like" << endl; 37 38 cout << "the book: "; 39 getline(cin, book); 40 cout << endl; 41 42 cout << "the chapter: "; 43 cin >> chapter; 44 cout << endl; 45 46 cout << "the verse: "; 47 cin >> verse; 48 cout << endl; 49 50 cout << book << " " << chapter << ":" << verse; 51 52 OT.close(); 53 54 return 0; 55}