Develop a data structure similar to a binary tree. Using a standard 8 X 8 chessboard, show the
knight’s movements in a game. As you may know, a knight’s basic move in chess is two forward
steps and one sidestep. Facing in any direction and given enough turns, it can move from any
square on the board to any other square.
If you want to know the simplest way your knight can move from one square (or node) to
another in a two-dimensional setup, you will first have to build a function like the one below.
knight plays ([0,0], [1,2]) == [[0,0], [1,2]]
knight plays ([0,0], [3,3]) == [[0,0], [1,2], [3,3]]
knight plays ([3,3], [0,0]) == [[3,3], [1,2], [0,0]]
a.create a script for a board game and a knight.
class String {
public:
String();
String(const char *str);
String(const String &);
String(int x);
char &operator[](int i);
const char operator[](int i) const;
String operator+(const String &str) const;
String operator+(const char &str) const;
String operator+(char *&str) const;
String operator-(const String &substr) const;
String operator-(const string &substr) const;
String& operator=(const String&);
String& operator=(char*);
String& operator=(const string&);
bool operator==(const String&) const;
bool operator==(const string&) const;
bool operator==(char *) const;
bool operator!();
// Function-Call Operators
int operator()(char) const;
int operator()(const String&) const;
int operator()(const string&) const;
int operator()(char *) const;
// Conversion Op
operator int() const;
~String();
};
ostream& operator<<(ostream& output, const String&);
istream& operator>>(istream& input, String&);
Write a program using string function that will accept the course abbreviation as input value and it will display the corresponding college.
COURSE COLLEGE
BSBIO CAS
BSA CBS
BSBA
BSAT
BSENTREP
BSINFOTECH CCS
BSIS
BSCS
BSAR CEA
BSCE
BSECE
BSEE
BSIE
BSME
BSHRM CHM
BSTM
EOC CIT
BSIT
BEED COE
BSEED
BPE
BSSOC CSSP
BSSW
Task 1
Write a C++ function in which it reads namesfrom file “data.txt” into character array and remove
the repeating names. Write your updated names list in another file called “output.txt”
Example:
Data.txt
Hira
Ali
Ahmad
Imran
Ali
Warda
Annie
Ali
Kinza
Hira
Output.txt
Hira
Ali
Ahmad
Imran
Warda
Annie
Kinza
Task 1
Write a C++ function in which it reads namesfrom file “data.txt” into character array and remove
the repeating names. Write your updated names list in another file called “output.txt”
Example:
Data.txt
Hira
Ali
Ahmad
Imran
Ali
Warda
Annie
Ali
Kinza
Hira
Output.txt
Hira
Ali
Ahmad
Imran
Warda
Annie
Kinza
Write a C++ program that finds and reverse all the occurrences of a substring, pat, in a string,
text. Show the output on console. The data is read from a user provided input file named as
“input.txt”.
Example:
text: abcduyeruyabcdmneaabcabcd
pat: abcd
text: dcbauyeruydcbamneaabcdcba
Write a C++ program that finds and reverse all the occurrences of a substring, pat, in a string,
text. Show the output on console. The data is read from a user provided input file named as
“input.txt”.
Example:
text: abcduyeruyabcdmneaabcabcd
pat: abcd
text: dcbauyeruydcbamneaabcdcba
Declare variables text type of string and chr type of char.
Declare variables iOperand1 and iOperand2 type of int.
Create a VB program that will compute for the sum, difference, product, quotient and remainder of quotient of two numbers.
sample output:
Math Operators:
1.Multiplication
2. Addition3. Division
4. Subtraction
5. Modulus Division
Select Operator: 1
Enter First Number: 3
Enter Second Number: 4
Product: 12