Home c++ What is the error in the code? C++

What is the error in the code? C++

Author

Date

Category

Severity Code Description Project File Line Suppression
Error C2143 Syntactic Error: No “;” Before “Constant”
Error C2065 SASE: An undeclared identifier
Error (actively) E0020 Identifier “SASE” is not defined

My task was to implement a program that can translate from one type of graph to another (from the incident matrix in the arrangement matrix, etc.). It is not clear why the compiler gives an error that does not understand what “Case” is. Sometimes other errors displays. Browse the code, can find what’s the matter? (For convenience, I also downloaded the code on Github: https://github.com/everso22/repos/blob/main/main.cpp

# include & lt; stdio.h & gt;
#Include & lt; stdlib.h & gt;
#Include & lt; conio.h & gt;
#Include & lt; locale.h & gt;
// declare and define the structure for the list // Armation
TypeDef struct _node
{
    INT VALUE;
    STRUCT _Node * Next;
}
Node;
// ---------------------------------------------------- ----
        // Selection Procedures
void miin (); // Input of the Incident Matrix
void msin (); // Enter the arrangement matrix
void ssin (); // Enter the adjacency list
     // Input procedures
Void Readarray (int *, int, int); // Matrix
node * readlist (); // List of adjacency
     // output procedures
Void Printarray (int *, int, int); // Matrix
Void PrintList (Node *); // List of adjacency
     // Transformation procedures
// m. incident - & gt; m. adjacency
void mi_ms (int *, int *, int, int);
// m. adjacency - & gt; List of adjacentness
Void MS_SS (INT *, INT, Node **);
// List of adjacencies - & gt; m. incident
Void SS_MI (INT *, INT, Node **);
     // Additional
// Counting the adjacency list items
INT COUNTINLIST (Node **, Int);
// Release memory for string from the list
Void Destroy (Node *);
INT MAIN ()
 {
  SETLOCALE (0, "RUS");
  INT CHOICE;
  PrintF ("Select the appropriate option: \ n");
  PrintF ("1 - Translate from an incetancy matrix \ n");
  Printf ("2 - Translate from the matrix of adjacency \ n");
  PrintF ("3 - translate from the list of adjacency \ n");
  PrintF ("0 - close the program \ n");
  Printf ("Your Choice:"); Scanf ("% d", & amp; choice);
  Switch (Choice)
  {
    CASE 1: MIIN (); Break;
    CASE 2: MSIN (); Break;
    CASE 3: SSIN (); Break;
    Default: Printf ("\ T The program closes ... \ n"); Break;
  }
  getch ();
  Return 0;
}
   // Definition of Functions ...
void miin ()
{
  INT M, N, I, CHOICE;
  int * a, * b;
  Node ** Arrayoflist;
  PrintF ("Specify the sizes of the array: \ n");
  PrintF ("M ="); scanf ("% d", & amp; m);
  PrintF ("n ="); Scanf ("% d", & amp; n);
  A = (int *) malloc (M * N * SizeOF (int));
  readarray (a, m, n);
  PrintF ("----------------------------------- n");
  PrintF ("Your Matrix of Incident: \ N");
  Printarray (A, M, N);
  Printf ("---------------------------------- \ n");
  Printf ("Select in what form to display: \ n");
  Printf ("1 - Translate into the arrangement matrix \ n");
  PrintF ("2 - Translate into the list of adjacency \ n");
  Scanf ("% d", & amp; choice);
  Switch (Choice)
  {
Case 1: Printf ("Transfer to the arrangement matrix \ n");
  B = (int *) Calloc (N * N, SizeOF (INT)); // Selecting memory for MS
        Mi_ms (a, b, m, n); // Transformation
  PRINTF ("\ Nissed arrangement matrix: \ n");
  Printf ("---------------------------------- \ n");
  Printarray (B, N, N); // The output of the resulting matrix
  Printf ("---------------------------------- \ n");
        FREE (A);
        FREE (B);
        Break;
    Case 2: B = (int *) Calloc (N * N, SizeOF (INT)); // Selecting memory for intermediate MS
        Mi_ms (a, b, m, n); // Transformation
        FREE (A);
  PrintF ("Transfer to the adjacency list \ n");
  Arrayoflist = (Node **) Malloc (N * SizeOF (Node *)); // Selection of memory for the SS 
MS_SS (B, N, Arrayoflist);
  PRINTF ("\ Nissed fitness list: \ n");
  Printf ("---------------------------------- \ n");
        for (i = 0; i & lt; n; i ++)
        {
          PrintF ("% d:", i + 1);
PrintList (* (Arrayoflist + i));
        }
Printf ("---------------------------------- \ n");
        FREE (B);
        for (i = 0; i & lt; n; i ++) Destroy (* (Arrayoflist + i));
        FREE (Arrayoflist);
        Break;
    Default: Printf ("\ Nonder-selection ... \ n"); FREE (A);
  }
}
Void MSIN ()
{
  INT M, N, I, CHOICE;
  int * a;
  Node ** Arrayoflist;
  PrintF ("Indicate the number of vertices: \ n");
  PrintF ("n ="); Scanf ("% d", & amp; n);
  A = (int *) malloc (n * n * sizeof (int));
  Readarray (A, N, N);
  Printf ("---------------------------------- \ n");
  PrintF ("arrangement matrix: \ n");
  Printarray (A, N, N);
  Printf ("---------------------------------- \ n");
  Printf ("Select in what form to display: \ n");
  PrintF ("1 - Translate to the adjacency list \ n");
 PrintF ("2 - Translate into the incidence matrix \ n");
  Scanf ("% d", & amp; choice);
  Switch (Choice)
  {
  CASE 1: PRINTF ("Transfer to the adjacency list \ n");
  Arrayoflist = (Node **) Malloc (N * SizeOF (Node *));
        MS_SS (A, N, Arrayoflist);
  PRINTF ("\ Nissed fitness list: \ n");
  Printf ("---------------------------------- \ n");
        for (i = 0; i & lt; n; i ++)
        {
          PrintF ("% d:", i + 1);
          PrintList (* (Arrayoflist + i));
        }
        FREE (A);
        for (i = 0; i & lt; n; i ++) Destroy (* (Arrayoflist + i));
        FREE (Arrayoflist);
        Break;
SASE 2: Arrayoflist = (Node **) Malloc (N * Sizeof (Node *));
        MS_SS (A, N, Arrayoflist);
      M = CountinList (ArrayOflist, N);
        FREE (A);
  PrintF ("Translation into the incidence matrix \ n");
      A = (int *) Calloc (M * N, SizeOF (int));
        SS_MI (A, N, Arrayoflist);
PRINTF ("\ Ni received matrix of incident: \ n");
Printf ("---------------------------------------- \ n");
        Printarray (A, M, N);
Printf ("---------------------------------------- \ n");
        FREE (A);
        for (i = 0; i & lt; n; i ++) Destroy (* (Arrayoflist + i));
        FREE (Arrayoflist);
        Break;
    Default: Printf ("\ Nonder-selection ... \ n"); FREE (A);
  }
}
void ssin ()
{
  INT M, N, I, CHOICE;
  int * a, * b;
  Node ** Arrayoflist;
  Printf ("\ N \ t + Number of vertices in the column:"); Scanf ("% d", & amp; n);
  Arrayoflist = (Node **) Malloc (N * SizeOF (Node *)); // Selection of memory under the SS
  for (i = 0; i & lt; n; i ++)
  {
    PrintF ("Top #% d \ n", i + 1);
    * (Arrayoflist + i) = readlist ();
  }
  Printf ("---------------------------------- \ n");
  PrintF ("List of adjacency: \ n");
  for (i = 0; i & lt; n; i ++)
  {
    PrintF ("% d:", i + 1);
    PrintList (* (Arrayoflist + i));
  }
  Printf ("---------------------------------- \ n");
  M = CountinList (ArrayOflist, N);
  Printf ("Select in what form to display: \ n");
Printf ("1 - Translation into the incidence matrix \ n");
  PrintF ("2 - Translation into the arrangement matrix \ n");
  Scanf ("% d", & amp; choice);
  Switch (Choice)
  {
Case 1: Printf ("Translation into an incidence matrix \ n");
    A = (int *) Calloc (M * N, SizeOF (int));
        SS_MI (A, N, Arrayoflist);
  Printf ("\ Nissed incident matrix:");
PrintF ("\ N -------------------------------------- \ n");
        Printarray (A, M, N);
PrintF ("---------------------------------------- \ n");
        FREE (A);
        for (i = 0; i & lt; n; i ++) Destroy (* (Arrayoflist + i));
        FREE (Arrayoflist);
        Break;
Case 2: A = (int *) Calloc (M * n, SizeOF (int));
        SS_MI (A, N, Arrayoflist);
        for (i = 0; i & lt; n; i ++) Destroy (* (Arrayoflist + i));
        FREE (Arrayoflist);
      B = (int *) Calloc (N * N, SizeOF (INT));
    PrintF ("Transfer to the arrangement matrix \ n");
        Mi_ms (a, b, m, n);
  PRINTF ("\ Nissed arrangement matrix:"); 
PrintF ("\ N -------------------------------------- \ n");
        Printarray (B, N, N);
PrintF ("---------------------------------------- \ n");
        FREE (A);
        FREE (B);
        Break;
    Default: PrintF ("\ Nonder selection \ n");
        for (i = 0; i & lt; n; i ++) Destroy (* (Arrayoflist + i));
        FREE (Arrayoflist);
  }
}
Void Readarray (int * a, int m, int n)
{
  int i, j;
  for (i = 0; i & lt; m; i ++)
    for (j = 0; j & lt; n; j ++)
    {
      Printf ("A [% d] [% d] =", i + 1, j + 1);
      Scanf ("% d", (A + I * N + J));
    }
}
Node * ReadList ()
{
  int i = 0, semn;
  int sizeofnode = Sizeof (Node);
  node * a = null, * r1, * r2;
  Printf ("% d:", ++ i); Scanf ("% d", & amp; semn);
  if (semn)
  {
    R1 = (Node *) Malloc (SizeOfnode);
    R1- & GT; Value = SEMN; R1- & gt; next = null;
    A = R1;
    Printf ("% d:", ++ i); Scanf ("% d", & amp; semn);
  }
  While (SEMN)
  {
    R2 = (Node *) Malloc (SizeOfnode);
    R2- & gt; Value = SEMN; R2- & gt; next = null;
    R1- & gt; next = R2; R1 = R2;
  Printf ("% d:", ++ i); Scanf ("% d", & amp; semn);
  }
  PrintF ("\ n");
  RETURN A;
}
Void Printarray (int * a, int m, int n)
{
  int i, j;
  for (i = 0; i & lt; m; i ++)
  {
  For (j = 0; j & lt; n; j ++) PrintF ("% 3D", * (A + I * N + J));
    PrintF ("\ n");
  }
}
Void PrintList (Node * R)
{
  int i = 0, semn;
  int sizeofnode = Sizeof (Node);
  While (R)
  {
    PrintF ("% 2D", R- & GT; VALUE);
    R = R- & GT; Next;
  }
  PrintF ("% 2D \ N", 0);
}
Void MI_MS (int * a, int * b, int m, int n)
{
  int i, j, a, b;
  for (i = 0; i & lt; m; i ++)
  {
    for (j = 0; j & lt; n; j ++)
      if (* (a + i * n + j) == 2) a = b = j;
      ELSE.
      {
        if (* (a + i * n + j) == - 1) a = j;
        if (* (a + i * n + j) == 1) b = j;
      }
    * (B + A * N + B) = 1;
  }
}
Void MS_SS (Int * A, Int N, Node ** Arrayoflist)
{
  int i, j, k;
  int sizeofnode = Sizeof (Node);
  Node * R1, * R2;
  for (i = 0; i & lt; n; i ++) // Find the first 1 in the string
  {
    j = 0; k = 0;
    While (! k & amp; & amp; (j & lt; n))
    {
      if (* (a + i * n + j)) k = j + 1;
      j ++;
    }
    // k = 0 - no in line 1 otherwise k - number // first 1 in the string (counting from 1)
    if (k)
    {
      R1 = (Node *) Malloc (SizeOfnode);
      R1- & GT; VALUE = K; R1- & gt; next = null;
      * (Arrayoflist + i) = R1;
      // continue to explore the string
      While (j & lt; n)
      {
        IF (* (A + I * N + J))
        {
      R2 = (Node *) Malloc (SizeOfnode);
      R2- & gt; Value = j + 1; R2- & gt; next = null;
          R1- & gt; next = R2; R1 = R2;
        }
        j ++;
      }
    }
    ELSE * (Arrayoflist + i) = null;
  }
}
Void SS_MI (Int * A, Int N, Node ** Arrayoflist)
{
  int i, j, k = 0;
  Node * R;
  for (i = 0; i & lt; n; i ++)
  {
    R = * (Arrayoflist + i);
    While (R)
    {
      if ((R- & GT; VALUE) -1 == i) * (A + K * N + i) = 2;
      ELSE.
      {
        * (A + k * n + i) = - 1;
        * (A + K * N + (R- & GT; VALUE) -1) = 1;
      }
      R = R- & GT; Next;
      k ++;
    }
  }
}
INT COUNTINLIST (Node ** Arrayoflist, Int N)
{
  int i, k = 0;
  Node * R;
  for (i = 0; i & lt; n; i ++)
  {
    R = * (Arrayoflist + i);
    While (R)
    {
      R = R- & GT; Next;
      k ++;
    }
  }
  RETURN K;
}
Void Destroy (Node * R)
{
  Node * TMP;
  While (R)
  {
    TMP = R;
    R = R- & GT; Next;
    FREE (TMP);
  }
}
 [1]: https://i.stack.imgur.com/xluvh.jpg

Answer 1

Do you have in the word case letters with and a Russian.

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions