online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
/****************************************************************************** Online C++ Compiler. Code, Compile, Run and Debug C++ program online. Write your code in this editor and press "Run" button to compile and execute it. *******************************************************************************/ #include <iostream> #include <fstream> #include <sstream> #include <vector> int main() { std::ifstream inputFile("input.txt"); std::string line; std::vector<std::pair<std::string, double>> vec; std::string name; double price, count; if(inputFile) { std::getline(inputFile, line, '\n'); while(std::getline(inputFile, line, '\n')) { std::istringstream ss(line); ss >> name; ss >> count; ss >> price; vec.push_back(std::make_pair(name, count * price)); } } else { std::cout<<"File cannot be opened"<<std::endl; } inputFile.close(); //lets print out the details for(const std::pair<std::string, double> &elem: vec) { std::cout<< elem.first<< ": "<< elem.second<<std::endl; } return 0; }
type count price bread 10 1.2 butter 6 3.5 bread 5 1.3 oil 20 3.3 butter 2 3.1 bread 3 1.1

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text
×

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue