关于vector的一些疑问!该如何解决

关于vector的一些疑问!
#include "stdafx.h"
#include<iostream>
#include<string>
#include<vector>
using namespace std;
class student{
public:
student();
~student(){}
friend ostream&operator<<(ostream&cout,student&s);
private:
int ID;
int Score;
string Name;
};
student::student()
{
cout<<"请输入学号\n";
cin>>ID;
cout<<"请输入姓名\n";
cin>>Name;
cout<<"请输入成绩\n";
cin>>Score;
}
ostream&operator<<(ostream&cout,student&s)
{
cout<<"学号:"<<s.ID<<"姓名:"<<s.Name<<"成绩:"<<s.Score<<endl;
return cout;
}
int _tmain(int argc, _TCHAR* argv[])
{
cout<<"欢迎使用学生信息管理系统\n";
cout<<"温馨提示\n请根据提示操作\n";
vector<student> a;
vector<student>::iterator is=a.begin();
int choice;
vector<int>::size_type place;
do{
cout<<"1 增加学生 2 插入学生 3输出学生 4 删除学生 0 退出\n";
cout<<"请输入你的选择\n";
cin>>choice;
switch(choice)
{
case 0:cout<<"您输入了0,退出本系统\n";break;
case 1:student b;//1:编译器报错: error C2360: “b”的初始化操作由“case”标签跳过;这是为什么啊??
a.push_back(b);
cout<<"增加成功\n";
break;
case 2:student c;
cout<<"请输入要插入的位置\n";cin>>place;
a.insert(is+place,c);/:2:就算把b,c的声明放在switch语句前,insert函数还是会导致崩溃
cout<<"插入成功\n";
break;
case 3:for(vector<int>::size_type i=0;i!=a.size();i++)
cout<<a[i]<<endl;
break;
case 4:
cout<<"请输入要删除的位置\n";cin>>place;
a.erase(is+place);
cout<<"删除成功\n";
break;
default:
cout<<"请输入0—4之间的整数\n";
break;
}
}
while(choice);
return 0;
}问题:1,2在主函数的注释部分!
问题3:VS2010中的int _tmain(int argc, _TCHAR* argv[]) 是否和int main(){return 0;}基本相同,有没有不同的地方

------解决方案--------------------
1.b的作用域只在于case 之后的那个局部的空间。。
一般我这么写
case CASE_VALUE:
{
Type val;//...这样的。 
}
break;
如果要在其它部分也用到,就必须放在switch之前了。
2.你的is迭代器可能失效。所以改为
a.insert(a.begin()+place,c);
3.都是入口函数。知识前者是vc的,后者是标准c/c++的。
除此之外没啥不同了。
------解决方案--------------------
不要在switch语句中定义变量或者创建对象,应为switch未必会走到你定义变量的那个case中,如果非要定义的话,把那个case冒号后的语句用{}括起来

int _tmain(int argc, _TCHAR* argv[])和int main(){return 0;}
前面一个运行时接受参数,一般不需要
------解决方案--------------------
问题一:关于b和c对象的定义[color=#0000FF][/color]
——要么把定义提前到主函数的开始部分,要么把case分支加上{}显示给出对象的作用域,否则上下两个case作用域一样,存在未初始化就被使用的可能

问题二:int _tmain[color=#0000FF][/color]
这个问题我原本不是很清楚,摘抄一段,和你分享,希望有帮助
1. Main是所有c或c++的程序执行的起点,_tmain是main为了支持unicode所使用的main的别名。_tmain()不过是unicode版本的的main().
  2. _tmain需要一个返回值,而main默认为void.
  3. _tmain的定义在<tchar.h>可以找到,如#define _tmain main,所以要加#include <tchar.h>才能用。_tmain()是个宏,如果是UNICODE则他是wmain()否则他是main().
  4. (一般_t、_T、T()这些东西都是宏都和unicode有关系),对于使用非unicode字符集的工程来说,实际上和main没有差别(其实就算是使用unicode字符集也未必有多大的差别)。
  5. 因此_tmain compile后仍为main,所以都可以执行.
------解决方案--------------------
探讨
引用:

1.b的作用域只在于case 之后的那个局部的空间。。
一般我这么写
case CASE_VALUE:
{
Type val;//...这样的。
}
break;
如果要在其它部分也用到,就必须放在switch之前了。
2.你的is迭代器可能失效。所以改为
a.insert(a.begin()+place,c);
3.都是入口函数。知识前者是vc的……

------解决方案--------------------