Skip to content
Snippets Groups Projects
Commit d984969f authored by Bartosz Ziemba's avatar Bartosz Ziemba
Browse files

msvc compability

parent 97576ba6
Branches master
No related merge requests found
.vscode/
build/
odm.txt
\ No newline at end of file
odm.txt
out/
.vs/
\ No newline at end of file
cmake_minimum_required(VERSION 3.0.0)
project(spellcheck VERSION 0.1.0)
set(CXX_STANDARD 17)
include(CTest)
enable_testing()
......@@ -8,7 +9,7 @@ if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
set(CMAKE_CXX_FLAGS "-Wall -Wextra")
set(CMAKE_CXX_FLAGS "-Wall ")
set(CMAKE_CXX_FLAGS_DEBUG "-g")
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
......
{
"configurations": [
{
"name": "x64-Debug",
"generator": "Ninja",
"configurationType": "Debug",
"inheritEnvironments": [ "msvc_x64_x64" ],
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "",
"ctestCommandArgs": ""
},
{
"name": "x64-Release",
"generator": "Ninja",
"configurationType": "Release",
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "",
"ctestCommandArgs": "",
"inheritEnvironments": [ "msvc_x64_x64" ],
"variables": []
}
]
}
\ No newline at end of file
......@@ -19,12 +19,8 @@ int main(int argc, char** argv)
size_t wrong_words_count;
size_t words_count;
driver.spellcheck_file(argv[2],words_count,wrong_words_count);
print("Number of words: ");
print(words_count);
print_line();
print("Number of incorrect words: ");
print(wrong_words_count);
print_line();
std::cout << "Number of words: " << words_count << std::endl;
std::cout << "Number of incorrect words: " << wrong_words_count << std::endl;
}
......
......@@ -6,11 +6,6 @@
#include <locale>
#include <vector>
void print(auto arg)
{
std::cout << arg;
}
void print_line(std::string line = "")
{
std::cout << line << "\n";
......@@ -89,7 +84,7 @@ public:
std::u16string u16wd;
while(true)
{
print("Input word: ");
std::cout << "Input word: ";
std::cin >> wd;
u16wd = utf16conv.from_bytes(wd);
if(trie.search(u16wd))
......
......@@ -106,7 +106,7 @@ public:
{
TrieNode* current = &root;
for (uint i=0;i<key.length();i++)
for (unsigned int i=0;i<key.length();i++)
{
current = &current->get_child(key[i]);
}
......@@ -117,7 +117,7 @@ public:
bool search(std::u16string key)
{
TrieNode* current = &root;
for(uint i=0;i<key.length();i++)
for(unsigned int i=0;i<key.length();i++)
{
//std::cout << "next index is " << index << "\n";
if(!current->has_child(key[i]))
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment