cin not working

Was wondering if anyone can help me figure out why the cin in my program is not working. When i run it only the first cin works.

#include <iostream> //Required header file for I/O
using namespace std; //Required command to set the compiler environment

//Start of main
int main()
{
int name;
double quiz1,
quiz2,
quiz3,
assignment1,
quizaverage,
quizpercentage,
lab1,
lab2,
lab3,
lab4,
labaverage,
labpercentage,
exam1,
exampercentage,
currentaverage,
maxquizaverage,
maxquizpercentage,
maxlabaverage,
maxlabpercentage,
exam2,
exam2percentage,
finalexam,
finalexampercentage,
maxpossible;




cout << "What is your name" << endl;
cin >> name;

cout << "Enter quiz 1 grade" << endl;
cin >> quiz1;
cout << "Enter quiz 2 grade" << endl;
cin >> quiz2;
cout << "Enter quiz 3 grade" << endl;
cin >> quiz3;
cout << "Enter assignment 1 grade" << endl;
cin >> assignment1;
quizaverage=(quiz1+quiz2+quiz3+assignment1)/4;
quizpercentage=(quizaverage * .15);

cout << "Enter lab 1 grade" << endl;
cin >> lab1;
cout << "Enter lab 2 grade" << endl;
cin >> lab2;
cout << "Enter lab 3 grade" << endl;
cin >> lab3;
cout << "Enter lab 4 grade" << endl;
cin >> lab4;
labaverage=(lab1+lab2+lab3+lab4)/4;
labpercentage=(labaverage * .30);

cout << "enter exam 1 grade" << endl;
cin >> exam1;
exampercentage= (exam1 * .15);
currentaverage= (exampercentage+labpercentage+exampercentage)/60;
maxquizaverage= (quiz1+quiz2+quiz3+assignment1+600)/10;
maxquizpercentage= (maxquizaverage * .15);
maxlabaverage= (lab1+lab2+lab3+lab4+1000)/14;
maxlabpercentage= (maxlabaverage * .30);
exam2=100;
exam2percentage= (exam2 * .15);
finalexam= 100;
finalexampercentage= (finalexam * .25);
maxpossible= (maxquizpercentage+maxlabpercentage+exampercentage+exam2percentage+finalexampercentage);


cout << "Your current lab average is " << labaverage << endl;
cout << "Your current quiz/assingment average is " << quizaverage << endl;
cout << "Your current average is " << currentaverage << endl;
cout << "The max grade you can make is " << maxpossible << endl;






return 0; //completes main function
} //end of main
You should be using a string for name.

All your variable's are set as double.
Topic archived. No new replies allowed.