Simple Code Issue

May 31, 2015 at 10:44pm
What is wrong with the way I input the code?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <iostream>
#include <string>
#include <iomanip>

using namespace std;
int main()
{
    //variables

const int daysOfClass==3;
int studentDaysInClass=2;
int attendanceGrade;
attendanceGrade==(studentDaysInClass/daysOfClass)*100;

cout<<attendanceGrade;

return 0;
}


The program outputs a random number instead of 66.
Last edited on May 31, 2015 at 10:45pm
May 31, 2015 at 10:54pm
Line 13, what is the difference between == and =?
May 31, 2015 at 11:05pm
== means equal

= means assign

should I assign it instead?
May 31, 2015 at 11:06pm
Line 13 I switched equal to assign and the program outputted "0".
May 31, 2015 at 11:33pm
Line 10, same issue.

Also, what is 2/3 if you round down?
May 31, 2015 at 11:34pm
ok ill change them from integers to doubles. and switch them the operators to assign.
May 31, 2015 at 11:35pm
yooooooo ispil you are the best man!!!!
May 31, 2015 at 11:36pm
thanks so much
Topic archived. No new replies allowed.