Académique Documents
Professionnel Documents
Culture Documents
Correction
#include <iostream>
using namespace std;
int main()
{
int width = 15, length = 20, area;
area = length * width;
cout<< "The area is " << area;
return 0;
}
Correction
#include <iostream>
using namespace std;
int main()
{
int length, width, area;
length = 20;
width = 15;
area = length * width;
cout << "The area is " << area;
return 0;
}
Correction
#include <iostream>
using namespace std;
int main()
{
int length = 20, width = 15, area;
area = length * width;
cout<< "The area is " << area;
return 0;
}
false
()
++, -++, -!
+, *, /, %
+, <=, >=, >, <
==, !=
&&
||
+=, -+, *=, /=, %=
=
Parentheses
Postincrement
Preincrement
Logical NOT
Positive, negative
Multiplication, division
Addition, subtraction
Relational operator
Relational operator
Logical AND
Logical OR
Compound assignment
Assignment
L to R
L to R
R to L
L to R
L to R
L to R
L to R
L to R
L to R
L to R
L to R
R to L
R to L
1
2
3
3
3
4
5
6
7
8
9
10
10
true
()
++, -++, -!
+, *, /, %
+, <=, >=, >, <
==, !=
&&
||
+=, -+, *=, /=, %=
=
Parentheses
Postincrement
Preincrement
Logical NOT
Positive, negative
Multiplication, division
Addition, subtraction
Relational operator
Relational operator
Logical AND
Logical OR
Compound assignment
Assignment
L to R
L to R
R to L
L to R
L to R
L to R
L to R
L to R
L to R
L to R
L to R
R to L
R to L
1
2
3
3
3
4
5
6
7
8
9
10
10
false
()
++, -++, -!
+, *, /, %
+, <=, >=, >, <
==, !=
&&
||
+=, -+, *=, /=, %=
=
Parentheses
Postincrement
Preincrement
Logical NOT
Positive, negative
Multiplication, division
Addition, subtraction
Relational operator
Relational operator
Logical AND
Logical OR
Compound assignment
Assignment
L to R
L to R
R to L
L to R
L to R
L to R
L to R
L to R
L to R
L to R
L to R
R to L
R to L
1
2
3
3
3
4
5
6
7
8
9
10
10
true
()
++, -++, -!
+, *, /, %
+, <=, >=, >, <
==, !=
&&
||
+=, -+, *=, /=, %=
=
Parentheses
Postincrement
Preincrement
Logical NOT
Positive, negative
Multiplication, division
Addition, subtraction
Relational operator
Relational operator
Logical AND
Logical OR
Compound assignment
Assignment
L to R
L to R
R to L
L to R
L to R
L to R
L to R
L to R
L to R
L to R
L to R
R to L
R to L
1
2
3
3
3
4
5
6
7
8
9
10
10
(distance == 30)
(temp == 30)
A speed is 55 mph.
(speed == 55)
(input == 'K')
Write a C++ program that accepts the code number as input and, based
on the value entered, displays the correct disk drive manufacturer.
Each disk drive in a shipment is stamped with a code from 1 through 4
to indicate the manufacturer, as follows:
16