What is the incorrect action and why does it occur?

Specification: Fill a character array with the uppercase alphabet (place A in [0], B in [1], etc.).
```
#include
using namespace std;
int main()
{
char alphabet[26];
int i;
for(i = 0; i< 26; ++i)
{
alphabet[i] = i;
}
return 0;
}
```


To put chars values into alphabet, need to remember chars are stored as ASCII integer codes. To fix this assignment, the integer must be offset to the ASCII 65 (for A) and cast into a char. Two fixes are shown here.
```
for(i = 0; i < 26; ++ i)
{
alphabet[i] = static_cast (i + 65);
}

or

for(i = 65; i < 91; ++ i)
{
alphabet[i] = static_cast( i ) ;
}
```

Computer Science & Information Technology

You might also like to view...

What do EIA and TIA stand for?

What will be an ideal response?

Computer Science & Information Technology

What values are used when configuring HyperTerminal for connecting to a Cisco router’s console port?

What will be an ideal response?

Computer Science & Information Technology

In a stacked layout, labels and text boxes are arranged:

A) in rows and columns like a table. B) vertically in one column with a label below each text box. C) vertically in one column with a label above each text box. D) vertically with a label to left of each text box.

Computer Science & Information Technology

Iterative SDLCs are often referred to as "______ methods" because they allow flexibility as development progresses.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology