Home > Software design >  I can't print contents from a vector or it's size c
I can't print contents from a vector or it's size c

Time:08-22

#include<iostream>
#include<vector>

int main() {
   
    std::vector<int> score = {1, 2, 3, 4};

    std::cout << score.size() << std::endl;
    
}

When I compile with "g filename.cpp" and then run "./a.exe" the terminal is empty my terminal

CodePudding user response:

I test your codes and meet the expected output: 4.

Can you give more details about your problem?

For example, after execute './a.out' command then execute 'echo $?' to know the exit code.

Secondly, 'g --version'.

Thirdly, add some invalid syntax sentences to test the compiler is working correctly or not?

CodePudding user response:

I have figured out the issue and a solution. I updated git bash to the latest version and it now prints properly to my git bash terminal. Thank you to everyone who took the time to type out a response and try to help, I really appreciate it all.

  • Related