I was using this code in visual studios 2013 with opencv 3.0.0 beta.
include<opencv\cv.hpp>
include<opencv\highgui.h>
using namespace cv; int main(){
Mat image;
VideoCapture cap;
cap.open(0);
cv::namedWindow("window", 1);
while (1)
{
cap >> image;
imshow("window", image);
waitKey(35);
}
}