online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
#include <iostream> #include<string> #include <sstream> #include <fstream> #include <climits> int main() { std::string line;//for storing a single line std::string numWord; //for storing a single number as std::string int max = INT_MIN, min = INT_MAX, num = 0, count =0; std::ifstream inFile("input.txt"); if(inFile) { while(std::getline(inFile, line))//go line by line { std::istringstream ss(line); while(ss >> num)//go number by number { if(num > max) { max = num;//update the maximum } if(num < min) { min = num; //update the minimum } ++count; } //you can add an if statement here to print the result only if count > 1 std::cout<<"max is: "<<max<<std::endl; std::cout<<"min is: "<<min<<std::endl; count = 0; //make the count 0 for next iteration max = INT_MIN; //reset max min = INT_MAX; //reset min std::cout<<"----------------------"<<std::endl; } } else { std::cout<<"input file cannot be opened"<<std::endl; } return 0; }
5 7 9 8 7 30032 51111 52000 42000 9 8 6 3 7 70000 23765 24000 41004

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