i am trying to write a small automated program to calculate some values for me and output some text to a simple .txt file. do the redirection symbols < > & << >> work the same in C++ as they do in the command line for batch scripts? When i try to search how to redirect to a .txt file in C++. All of the examples, and tutorials i have found are presented in a manner that assumes IO on the console like the following.
    cout::<<"show this text on the console";
    cin::>> whatever you would call here to accept user input.
what i want to know is will it work to do it this way?
    #include <string>
     using namespace std;
    int main()
    {
        int X = 0;
        string zero = "touchPress 0 483 652\n";
    if {
     (X=0)
    zero>>C:\test.txt;
    x+5;
   } return 0;
}
 
     
    