Posts

Quiz

Question : Why main function is special in C++ ? Show/Hide the answer. Answer : Whenever a C++ program is executed, execution of the program starts and ends at main(). The main is the driver function of the program. If it is not present in a program, no execution can take place. Question : What is run-time error, logical error and syntax error? Show/Hide the answer. Answer : Syntax error - The errors which are traced by the compiler during compilation, due to wrong grammar for the language used in the program, are called syntax errors. For example, cin<<a; // instead of extraction operator insertion operator is used. Run time Error - The errors encountered during execution of the program, due to unexpected input or output are called run-time error. For example - a=n/0; // division by zero Logical Error - These errors are encountered when the program does not give the desired output, due to wrong logic of the program. For example : rema

Question Papers

  C++ Sample Papers - Class XII Solved sample papers with Marking scheme for Computer Science with C++ Sample Paper 1 Sample Paper 2 Sample Paper 3 Sample Paper 4 Python Sample Papers (New Syllabus) - Class XII Sample Paper 1 Sample Paper 2

Tic Tac Toe Game Project

  Description:This C++ program on TIC TAC TOE GAME is a simple text base game. This program is without grahics to focus on logic /algorithm used in game. Two players can play this game. #include <iostream> using namespace std ; char square [ 10 ] = { 'o' , '1' , '2' , '3' , '4' , '5' , '6' , '7' , '8' , '9' }; int checkwin (); void board (); int main () { int player = 1 , i , choice ; char mark ; do { board (); player =( player % 2 )? 1 : 2 ; cout << "Player " << player << ", enter a number: " ; cin >> choice ; mark =( player == 1 ) ? 'X' : 'O' ; if ( choice == 1 && square [ 1 ] == '1' ) square [ 1 ] = mark ; else if ( choice == 2 && square [ 2 ] == '2' )