-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
38 lines (31 loc) · 1.02 KB
/
main.cpp
File metadata and controls
38 lines (31 loc) · 1.02 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
#include <iostream>
#include <fstream>
#include <string>
#include <ios>
#include "myLibrary.h"
int main (int argc, char *argv[])//бесконечный ввод
{
// checking argument number
if (argc < 5 or argc > 5)
{
std::cout << "Incorrect number of arguments" << std::endl;
return 0; // correct end of app, but with error message for user
}
// file opening
std::ifstream file;
file.open(argv[1], std::ios::in);
if (!file.is_open())
{
std::cout << "Incorrect file name" << std::endl;
return 0; // correct end of app, but with error message for user
}
// converting input words to a lowercase strings
std::wstring firstWord, secondWord;
firstWord = strToWstringLower(std::string(argv[2]));
secondWord = strToWstringLower(std::string(argv[3]));
// main path of app
std::cout << findWordPair (file, firstWord, secondWord, std::atoi(argv[4])) << std::endl;
//file closing and the end of app
file.close();
return 0;
}