Annoying error.

Hello. This is my first time here. Anyways, I was working on code and making structs, when I got an error stating that said ERROR: two or more data types in declaration. I looked online, but couldn't find anything. If you can help, I would be very happy. Here is the code:

#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <ctime>
#include <cstdlib>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>

using namespace std;

struct mGrid
{
char xny [8][8] ;
bool isHit;
}

struct shipp{
int bigness;
bool vert;
bool sunkd;
} patrol, destroy, sub, battle, carrier; <------
int main()
{

// The rest is unnecisary
// The error is in the line above with the names of the ships.
Last edited on
Hello!

You are missing a semicolon after the class declaration of mGrid.
missing semicolon ; after first struct declaration..
you can learn more on struct here: http://www.cplusplus.com/doc/tutorial/structures/

it should be

1
2
3
4
5
6
7
8
9
10
11
12
struct mGrid
{
      char xny [8][8] ;
      bool isHit;
};

struct shipp
{
      int bigness;
      bool vert;
      bool sunkd;
} patrol, destroy, sub, battle, carrier;
Topic archived. No new replies allowed.