What is the proper logic and code to find the number of rows and columns while reading from a file (.txt)??means if we have to find the rows and columns from a 2D grid map?
please reply soon as possible.
That depends on the files format. A common method is to delimit the column with specific characters that do not otherwise appear in the file such as commas or tabs, these are called "comma separated value" and "tab delimited" respectfully. Another older way is to give each column a specific width, this is called a "white space delimited" file and requires you to pad each entry (automatically of course) that does not meet the required spacing.