Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Skill Build.cpp : Defines the entry point for the console application.
- //
- #include "stdafx.h"
- #include <iostream>
- #include <fstream>
- #include <string>
- #include <cctype>
- #include <sstream>
- #include <cstdlib>
- void skillBuild(std::ostream& os,std::string name, int start, int end, int SP) {
- for(int i = start; i<= end; i++) {
- while(i<=end) {
- int addition;
- switch(SP) {
- case 29: addition = 1;
- break;
- case 28: addition = 2;
- break;
- default: addition = 3;
- }
- SP += addition;
- os << i << ". " << addition << " " << name << " (" << SP << ")\n";
- i++;
- }
- }
- }
- int main() {
- std::ofstream of;
- std::string file;
- std::stringstream ss;
- std::cout << "Enter a file name: ";
- getline(std::cin, file);
- of.open(file);
- if(!of.is_open()) {
- std::cout << "File cannot be opened, exiting ";
- std::cin.get();
- exit(1);
- }
- do {
- skillStart:
- std::cout << "Starting level?: ";
- int s, e, sp;
- std::string input;
- std::cin.clear();
- getline(std::cin, input);
- ss << input;
- ss >> s;
- ss.str("");
- ss.clear();
- std::cout << "Ending level?: ";
- getline(std::cin, input);
- ss << input;
- ss >> e;
- ss.str("");
- ss.clear();
- std::cout << "Skill name?: ";
- std::string skillName;
- getline(std::cin, skillName);
- std::cout << "Starting SP?: ";
- getline(std::cin, input);
- ss << input;
- ss >> sp;
- ss.str("");
- ss.clear();
- skillBuild(std::cout, skillName, s, e, sp);
- skillBuild(of,skillName,s,e,sp);
- std::cout << "Another skill? Y or N: ";
- char retry;
- std::cin >> retry;
- toupper(retry);
- std::cin.get();
- if(!(retry != 'Y' || retry != 'N')) {
- std::cout << "Please enter a valid input: ";
- std::cin >> retry;
- toupper(retry);
- std::cin.get();
- }
- else if(retry == 'Y')
- goto skillStart;
- else if(retry == 'N')
- of.close();
- }
- while(of.is_open());
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement