Whats wrong here?

#include <iostream>
#include <stdexcept>
#include <stdio.h>
#include <string>
int main()
std::string result = system( "./some_command" )
return 0;
Whats wrong here?

Missing apostophe.
Missing code tags.
Header is <cstdlib>
Missing braces.
Missing semicolon.
system() returns int.
Missing apostophe.
Missing code tags.
Header is <cstdlib>
Missing braces.
Missing semicolon.
system() returns int.

I forgot to post code code tags

1
2
3
4
5
6
7
8
9
10
#include <iostream>
#include <stdexcept>
#include <stdio.h>
#include <string>
#include <cstdlib>
int main()

std::string result = system( "./some_command" )
return int;

Where I need brackets, apostophe and what semicolon?
Last edited on
>Where I need brackets
You need curly braces around the body of the main function:

1
2
3
4
int main()
{
    // your code goes here
}


http://www.cplusplus.com/doc/tutorial/program_structure/

>apostophe
I chuckled after I looked back over the op and realized what Chervil was talking about. Hint: What's wrong with your title ;)

>and what semicolon
The one that is missing from the end of line 8.

>return int;
I don't think that is what he meant. The system call (on line 8) will return an int, not an std::string (thus result should be of type int). The original return statement you had was correct (return 0;).

http://en.cppreference.com/w/cpp/utility/program/system
Topic archived. No new replies allowed.