// Pr1Help.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include #include #include "Pr1Help.h" element::element(const std::string &tag) { htmlStr = "<" + tag + ">"; } element& element::addAttribute(const std::string &name, const std::string &val) { size_t pos = htmlStr.find_first_of(">"); if(pos == htmlStr.length()) throw std::exception(std::domain_error("can't find tag end")); std::string temp = " "; temp += name + "=\"" + val + "\""; htmlStr.insert(pos,temp); return *this; } element& element::addBody(const std::string &body) { size_t pos = htmlStr.find_last_of("/"); if(pos == htmlStr.length() || pos < 1) throw std::exception(std::domain_error("can't find end tag")); htmlStr.insert(pos-1,body); return *this; } std::string element::value() { return htmlStr; } element::~element() { } using namespace std; int _tmain(int argc, _TCHAR* argv[]) { if(argc == 1) { cout << "\n Please provide tag name as input argument\n\n"; return 1; } for(int i=1; i