namespace questions and difference between IDE’s

  c++

Ive been following along with some c++ tutorials on youtube and I cant seem to get this code to work, I use code blocks and this person uses visual c++. Is there a difference between them somehow? before I did cin >> std::Asalary; she asked what whould happen if you ran this code, she got an error and I got zero which makes sense, so im kinda lost on both of these problems. any help whould be epic, thanks in advance.

 #include <iostream>

 using std::cout;
 using  std::endl;
 using std::string;


 namespace main1 {
 double Asalary;
 double MonthSal = Asalary/12;


 }

 int main()
 {
     cout << "enter your annual salary" << endl;
    cin >> main1::Asalary;
    cout << main1::MonthSal << endl;
 }

Source: Windows Questions C++

LEAVE A COMMENT