Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //I've got an example in a C++ book that is given without context.
- //I'm trying to put it in different ways, but Visual Studio 2015 compiler gives "ugh" in any of my attempts
- //Is it possible there is a mistake somewhere?
- //
- // This is the example as is:
- //struct complex{
- // float real, im;
- //} compl [2][3] = {
- // { { 1,1 },{ 1,1 },{ 1,1 } },
- // { { 2,2 },{ 2,2 },{ 2,2 } }
- //};
- // this is what I am doing:
- #include <iostream>
- #include <string>
- using namespace std;
- struct complex{
- float real, im;
- } compl [2][3] = { //error: expected an ;
- { {1,1}, {1,1}, {1,1} },
- { {2,2}, {2,2}, {2,2} }
- };
- int main() {
- struct complex {
- float real, im;
- } compl [2][3] = { //error: expected an ; && error: expected an identifier
- { { 1,1 },{ 1,1 },{ 1,1 } },
- { { 2,2 },{ 2,2 },{ 2,2 } }
- };
- cin.ignore();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement