Problems with online compiler

I can no longer access the online compiler when I click the gear button. It says Firefox cannot establish a connection. It does it with all my other browsers as well. Please help, I need to compile and run my program, but I can only do it with this website.
Last edited on
MiiNiPaa wrote:
http://ideone.com/
http://coliru.stacked-crooked.com/


With the second one, it does not allow me to type input. With the first one, witch C++ do I choose?
The second one you can but you need to give the input when you invoke the program.
The first one you should choose the c++11.
giblit wrote:
The second one you can but you need to give the input when you invoke the program.


How would I type the input before running the program?
http://coliru.stacked-crooked.com/a/797e33156ba46430
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <iostream>

int main()
{
    int input = 1;
    int sum = 0;
    while(input)
    {
        std::cin >> input;
        std::cout << "The inputted number was: " << input << '\n';
        sum += input;
    }
    std::cout << "The sum of these numbers is " << sum << std::endl;
    
    return 0;
}
The inputted number was: 1
The inputted number was: 2
The inputted number was: 3
The inputted number was: 4
The inputted number was: 5
The inputted number was: 6
The inputted number was: 7
The inputted number was: 8
The inputted number was: 9
The inputted number was: 0
The sum of these numbers is 45


Compiled with g++ main.cpp && ./a.out <<< "1 2 3 4 5 6 7 8 9 0" though you can use clang if you want.
@giblit, could you please go more in depth with how to type the input? I do not understand how you got the input data to show up, it did not work for me.
<<< redirects the input. It's a bash command. http://wiki.bash-hackers.org/howto/redirection_tutorial

Then the stuff being redirected is
"1 2 3 4 5 6 7 8 9 0"
I do not understand what you are trying to tell me.
1) Open http://coliru.stacked-crooked.com/
2) Notice another text field at the bottom of the page, to the left of Compile, link and run button.
3) It has something like g++ main.cpp && ./a.out
4) Change it so it reads g++ main.cpp && ./a.out <<< "1 2 3 4 5 6 7 8 9 0" where bold part is what do you want to pass into program.
You also will pass any other compiler flags there such as -wall -std=c++11 -std=c++1y -pedantic-errors ect...
Last edited on
Topic archived. No new replies allowed.