项目作者: Pujolsluis

项目描述 :
Program to generate a collection of strings for a Collection Initialization (Vector, List, etc).
高级语言: C++
项目地址: git://github.com/Pujolsluis/StringListGenerator.git
创建时间: 2018-04-09T18:36:20Z
项目社区:https://github.com/Pujolsluis/StringListGenerator

开源协议:MIT License

下载


String List Generator

Program to generate a collection of strings for a Collection Initialization (Vector, List, etc).

How to use

  • Clone the repo.
  • Open and compile Project in your C++ IDE of Choice.
  • Run the Program and insert an input file with space or line break separated strings.
  • Check that if you are on Windows you have activated the Quick Edit Mode in your cmd. To do so right click you’re cmd choose Properties > Options > Edit Options.
  • Insert the EOF Signal to the console Windows: Ctrl + Z or Mac: Cmd + D

Examples (List types)

You can input a list of sentences with line breaks.

  1. 3D animation
  2. The game has started
  3. Jump over the fence
  4. Runing as fast as the speed of light
  5. Looking into the eyes of the lion

or

You can input a list of space separated words.

  1. Cat Dog Fish Hamster Crocodile

Result

Copy and paste the result to you’re app source code and you’re ready to keep on you’re happy coding streak!

  1. ---- DONE READING INPUT FILE ----
  2. "3D animation",
  3. "The game has started",
  4. "Jump over the fence",
  5. "Runing as fast as the speed of light",
  6. "Looking into the eyes of the lion",
  7. ---- DONE PRINTING OUTPUT ----
  1. ---- DONE READING INPUT FILE ----
  2. "Cat",
  3. "Dog",
  4. "Fish",
  5. "Hamster",
  6. "Crocodile",
  7. ---- DONE PRINTING OUTPUT ----

Type of lists

If you wish to switch between the type of input files you are going to read you just need to comment and uncomment the following lines of code.

  1. // Line break sentence list.
  2. while(getline(cin, inputString)){
  3. inputList.push_back(inputString);
  4. }
  5. // Space separated word list.
  6. /*
  7. while(cin >> inputString){
  8. inputList.push_back(inputString);
  9. }
  10. */

Sorting

If you wish to sort the list before printing it out to initialize you’re own collection, you can uncomment the following line in the program and it will sort the list before giving you the output.

  1. // sort(inputList.begin(), inputList.end());

Contributors

If you wish to contribute to the project all ideas and improvements are welcomed, send in a PR and add yourself in the list of Contributors!