且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

它向我显示第86行和第1581行中的2个错误...如何删除

更新时间:2023-10-25 09:12:04

Double click the error message - it usually takes you to the line.
If you can''t do that, open your code in a text editor and try pressing CTRL+G - that very often brings up a "goto line" box which lest you move immediately to a specific line number, in this case 86. Looking around that line, and it''s obvious:
Double click the error message - it usually takes you to the line.
If you can''t do that, open your code in a text editor and try pressing CTRL+G - that very often brings up a "goto line" box which lest you move immediately to a specific line number, in this case 86. Looking around that line, and it''s obvious:
void lines :: line_ver(int row1, int row2, int column, char c)
{
   for ( row1; row1<=row2; row1++ )
   {
      gotoxy(column,row1) ;
      cout <<c ;
   }
//	CLASS NAME    : lines
//	FUNCTION NAME : box
//	DETAILS       : IT ACCEPTS THE ROWS AND COLUMNS AND
//				 DRAW THE BOX
void lines :: box(int column1, int row1, int column2, int row2, char c)
{   char ch=218 ;
   char c1, c2, c3, c4 ;
   char l1=196, l2=179 ;

Where is the closing bracket for line_ver?

Where is the closing bracket for line_ver?


Thanks to Griff for formatting the code.

There is a missing ''}'' around (probably before) line 86:
Thanks to Griff for formatting the code.

There is a missing ''}'' around (probably before) line 86:
void lines :: line_ver(int row1, int row2, int column, char c)
{
   for ( row1; row1<=row2; row1++ )
   {
      gotoxy(column,row1) ;
      cout <<c ;
   }
// -> This is missing in your code
}
//	CLASS NAME    : lines


The error in line 1581 should be also gone now (assuming that ist was about a missing closing ''}'').

Tip:
Most code editors allow collapsing blocks (often indicated by a ''-'' symbol on the left). Use this feature when available and you got errors about missing parentheses to find them quickly.


The error in line 1581 should be also gone now (assuming that ist was about a missing closing ''}'').

Tip:
Most code editors allow collapsing blocks (often indicated by a ''-'' symbol on the left). Use this feature when available and you got errors about missing parentheses to find them quickly.


Also

Also

	} while ( !valid ) ;
   } while (ch == 'Y’);

// <-- Here there is also a missing {

//	CLASS NAME    : quiz
//	FUNCTION NAME : found_record



When you have an error, the problem is usually before or at the point the error is reported by the compiler. If you would improve your code formatting by adding blank lines between functions and avoid writing function that are way too long (and with too many indentation levels), it would be much easier to find that kind of errors.

By the way, that code is poorly written as it does not follows most accepted rules of good coding practice. Here are some problems:

    - Lot of hard coded constants everywhere.
    - Missing parameter names in function declaration.
    - Inconsistant indentation.
    - Inconsistant and discutable use of white space.
    - Very long functions with multiple responsabilities.
    - ....

Reading books on writing solid code might be a good idea...



When you have an error, the problem is usually before or at the point the error is reported by the compiler. If you would improve your code formatting by adding blank lines between functions and avoid writing function that are way too long (and with too many indentation levels), it would be much easier to find that kind of errors.

By the way, that code is poorly written as it does not follows most accepted rules of good coding practice. Here are some problems:

    - Lot of hard coded constants everywhere.
    - Missing parameter names in function declaration.
    - Inconsistant indentation.
    - Inconsistant and discutable use of white space.
    - Very long functions with multiple responsabilities.
    - ....

Reading books on writing solid code might be a good idea...