<< Help please.

Hi everyone,

I want to write a code where example:

1
2
3
4
5
char ch;

if (ch == '/*') // ignore until the other '*/'

if (ch == '//') // ignore until the '\n'  


I am trying to read braces and see if the code is balanced.

I really do not know which the functions to use.


PS. Also I need to print every 15 lines in an output file,
somehow I need to count the '\n' character and make a:

1
2
3

for (i=0, i =15; i++)
cout << "the 15 lines that i got from the input file";


I hope I am making some sence and help is very much apreciated.

Thanks in advance
I think one for the // line

I can use this:

1
2
3
4

cin.ignore(1000, '\n')

// but I want to count '\n' and do not know how to do that. 
closed account (zb0S216C)
char data types can only hold a single character. If you compiled the first code segment, the compilation stage will stop an throw an error at you regarding string literals.

Are you trying to build a parser or something? If so, try reading the link I provided[1].

References:
[1]http://homepages.cwi.nl/~daybuild/daily-books/learning-about/syntax-analysis/syntax-analysis.html


Wazzak
No i am not trying to build a parses
Topic archived. No new replies allowed.