Here is the code

#include <iostream> #include <vector> using namespace std; int main () { vector<double> v; v.push_back(2.7); v.push_back(5.6); v.push_back(7.9); for(int = 0; i < v.size(); ++i) { cout << "v[" << i << "]==" << v[i] << "\n"; } } 

When compiling writes

"C: \ Users \ Nikita \ Desktop \ Untitled1.cpp: 15: 41: Waring: missing terminating '" "character [-Winvalid-pp-token]

 cout << "v[" << i << "]==" << v[i] << "\n"; ^ 

"C: \ Users \ Nikita \ Desktop \ Untitled1.cpp: 15: 41: error: expected expression
1error and 1 waring generated

Please explain why this is happening? I am a beginner and still learn.

    2 answers 2

    Listen, well, can you at least 5 minutes think before you run to ask?

     for(int = 0; 

    What variable do you declare here?

    Everything else compiles perfectly: https://ideone.com/6fFF6x

        for(int i = 0; i < v.size(); ++i) 

      I'm not sure, but I think I need to declare a variable.