i'm trying to figure out what is the use of the question mark (?) inside the brackets on the last assignment statement, i wonder if it's a typing error?
thanks for helping
1 2 3 4
int x = 0;
for (int i = 0; i < 4; i++)
{
x += (i % 2 ? 1 : 0);
#include <iostream>
usingnamespace std;
int main()
{
{
int x = 0;
for (int i = 0; i < 4; i++)
{
x += (i % 2 ? 1 : 0);
}
cout << "x = " << x << '\n';
}
{
int x = 0;
for (int i = 0; i < 4; i++)
{
if (i % 2)
x += 1;
}
cout << "x = " << x << '\n';
}
{
int x = 0;
for (int i = 0; i < 4; i++)
{
x += (i % 2);
}
cout << "x = " << x << '\n';
}
}