看起来我的代码是正确的,根据我能在网上找到的所有文档。我的IDE是MS Visual Studio Xpress 4 Windows Desktop 2012,但它的编译器出现了以下错误:
Error 1 error C3861: 'setenv':未找到标识符e:\users\owner\documents\visual studio 2012\projects\project1\project1\source1.cpp 18 1 Project1
。
帮帮我!!!
#include <windows.h>
#include <sstream>
#include <ostream>
#include <cstdlib>
#include <iostream>
#include <stdlib.h>
using namespace std;
int howManyInClass = 0;
int main(){
long checklength = sizeof(getenv("classSize"))/sizeof(*getenv("classSize"));
if (checklength==0){
cout<<"Please enter the ammount of students in your class";
cin>> howManyInClass;
cin.ignore();
setenv("classSize", howManyInClass, 1);}
};