Welcome to the world of game development!After a long journey to find ‘optimum’,

Welcome to the world of game development!After a long journey to find ‘optimum’, ‘free’ resources for Unreal Engine 5, I decided that we will instead use a much lighter-weight alternative. Sorry to those who already installed it–play with it and learn to make games visually with Blueprints… 🙂
We’re going to try out raylib, which is an open source, relatively lightweight game engine.
Watch and follow along with the videos below–that is, reproduce everything as shown in the videos.
How to install raylib with C++ on Windows and use it with Visual Studio Code (<5mins)https://www.youtube.com/watch?v=PaAcVk5jUd8Links to an external site. Pong Game with C++ and Raylib - Beginner Tutorial (~45mins)https://www.youtube.com/watch?v=VLJlTaFvHo4Links to an external site. Note that you will likely need to pause and re-watch multiple parts of the videos in order to ensure you're doing everything correctly Your submission will consist of FIVE (5) screenshots (all pasted into a single Word doc): Screenshot with your desktop running VS Code (or Visual Studio) Screenshot showing a folder with the raylib template files (as demonstrated in the video) At least three (3) screenshots of the pong game in development--your choice which steps to choose BONUS (50pts): running, completely functional pong game--including something on the screen that identifies you so I know it's not from someone else Resources: VS Code and Visual Studio Community: https://visualstudio.microsoft.com/free-developer-offers/Links to an external site. raylib video game library: https://www.raylib.com/Links to an external site. Source code for pong game from video: https://github.com/educ8s/Cpp-Pong-Game-RaylibLinks to an external site.

Posted in C++

Instructions for answering I have help for Q2, Q3, and Q4, I have codes you will

Instructions for answering
I have help for Q2, Q3, and Q4, I have codes you will modify and use to answer Q2, Q3, and Q4. For these questions, you need to modify the codes according to the question given and use the part that is suitable for the question. Please answer all questions (Q1, Q2, Q3, Q4).
When you answer them I need them like this :
Q1- type your answer
Q2- type your answer
Q3- type your answer
Q4- type your answer
————————————————————————————————
Here questions :
Q1- Write a main function to test the function max. Your program should ask the user to enter two numbers (an int and a double), then it displays the maximum.
Example of the output of the program:
The maximum of 6 and 8.3 is: 8.3
Q2- Create a new CPP file named classTemplates.cpp
Implement the class template named SimpleVector which may include general data types. The SimplteVector might be a list of ints, a list of doubles, etc.
Q3- Implement the class Time that contains the following properties: int hou, int min, int sec.
Implement the getters of the class Time.
Q4- Test your code by creating an instance of SimpleVector holding elements of type Time, the size of the array is 10, fill in the table and display it
————————————————————————————————
Here the codes
#include
#include
#include
using namespace std;
template
class SimpleVector
{
private:
T *aptr;
int arraySize;
void memError();
void subError();
public:
SimpleVector()
{
aptr = 0;
arraySize = 0;
}
SimpleVector(int);
SimpleVector(const SimpleVector &);
~SimpleVector();
int size() const
{ return arraySize; }
T &operator[](const int &);
T getElementAt(int sub);
};
template
SimpleVector::SimpleVector(int s)
{
arraySize = s;
try
{
aptr = new T[s];
}
catch(bad_alloc)
{
memError();
}
}
template
SimpleVector::SimpleVector(const SimpleVector &obj)
{
arraySize = obj.arraySize;
aptr = new T[arraySize];
if (aptr == 0)
memError();
for (int count =0; count < arraySize; count++) *(aptr + count) = *(obj.aptr + count); } template
SimpleVector::~SimpleVector()
{
if (arraySize > 0)
delete[] aptr;
}
template
void SimpleVector::memError()
{
cout << "ERROR: Cannot allocate memory.n"; exit(EXIT_FAILURE); } template
void SimpleVector::subError()
{
cout << "ERROR: Subscript out of range.n"; exit(EXIT_FAILURE); } template
T &SimpleVector::operator[](const int &sub)
{
if (sub < 0|| sub >= arraySize)
subError();
return aptr[sub];
}
class Date
{
private:
int day;
int month;
int year;
public:
Date()
{
day = 1;
month = 1;
year = 1900;
}
Date(int d, int m, int y)
{
day = d;
month = m;
year = y;
}
int getDay()
{ return day; }
int getMonth()
{ return month; }
int getYear()
{ return year; }
Date &operator=(const Date &obj)
{
day = obj.day;
month = obj.month;
year = obj.year;
return *(this);
}
int operator==(const Date &obj)
{
if((day == obj.day) && (month == obj.month) && (year == obj.year))
return 1;
else
return 0;
}
};
template
T SimpleVector::getElementAt(int sub)
{
if (sub < 0 || sub >= arraySize)
subError();
return aptr[sub];
}
template
class SearchableVector : public SimpleVector
{
public:
SearchableVector() : SearchableVector()
{
}
SearchableVector(int size) : SimpleVector(size)
{
}
int findItem(const T);
};
template
int SearchableVector::findItem(const T item)
{
for (int count = 0; count <= this->size(); count++)
{
if (this->getElementAt(count) == item)
return count;
}
return -1;
}
int main()
{
const int SIZE = 10;
int count;
SearchableVector DateTable(SIZE);
for (count = 0; count < SIZE; count++) { DateTable[count] = Date(count, 05, 2023); } cout << "These values are in date table:n"; for (count = 0; count

Posted in C++

Investigate the concept of function and class templates in C++. Discuss their pu

Investigate the concept of function and class templates in C++. Discuss their purpose, benefits, and challenges and when they are best used. Further, discuss the purpose and value of a type parameter. Ensure that you can write a simple function template by providing an implementation of one from your research.

Posted in C++

There’s no actual programming involved in this assignment. Rather, you must exa

There’s no actual programming involved in this assignment. Rather, you must examine the code (after–and while–playing the game :)), answering the questions below.
Go to https://replit.com/@rammonsnova/Pong#main.cpp and make your own forked copy.
Questions (submit in a single Word doc):
What are the user game controls/keys?
What’s the refresh interval for updating/redrawing the game?
Explain how the Paddle class works, including as many details as you think necessary for someone with very minimal understanding of coding.
Do the same for the Ball class.
How does the game continue to run even when no keys are pressed? How does it detect a key press?
Pick one part of the code that interests you; state what it is and WHY you find it interesting.
Submit all responses in a single Word document. Spend AT LEAST one (1) hour on this to get full credit.

Posted in C++

Need to write code in C++, will give question and example below. I do use visual

Need to write code in C++, will give question and example below. I do use visual studio 2022 if you are wondering. Thank you.
Problem:
Given the following input:
A character value (a letter from the English alphabet)
A string value (string consisting of only English letters and spaces)

Write a C++ program using functions to print the numbers of times the character appears in the string. The character to check in the string is case-sensitive (i.e. checking for an uppercase ‘A’ in the string is not the same as checking for a lowercase ‘a’).

Your solution must follow the requirements presented below:
Do not use cout to print a message before reading the input from STDIN.
Read the input in the main function. Note that the string may contain spaces.
Write a function that returns the number of times the character appears in the string.
You can assume that the input from STDIN will always be valid.
Example:
Input
Output

C Computer Science
1

a apple banana
4

F functions are fun
0

D qwertyuiopasdfghjklzxcvbnm
0

#include
#include
using namespace std;
// Write a function that returns the number of times the character appears in the string.

int main()
{
char myChar;
string myString;
int result;
// Read in the character and assign it to myChar
// Read in the string. Note that the string may contain spaces.

// Call the function.
result =

cout << endl <<“Number of times the character appears in the string = “ << result << endl; return 0; }

Posted in C++

Create a C++ app that reads data from a text file into a vector of structs and s

Create a C++ app that reads data from a text file into a vector of structs and sorts the vector elements.
Use this data file: mlb_pitchers.csv.
Each line of data contains a pitcher’s name and the number of games he won during his career in the big leagues.
Create a struct data type named Pitcher that stores these two data items in member variables of the appropriate type.
Declare a variable of type Pitcher that is local to the main() function.
Test point: test your code by manually setting your Pitcher variable’s member data and displaying the values.
Use a loop to read each line of data from the data file into a vector that has elements of type Pitcher.Use std::string::substr() to separate the pitcher’s name from his number of wins, and store the name in your Pitcher variable.
Use std::stoi() to convert the number of wins represented as text in the file to a number, and store the number in your Pitcher variable.
Use std::vector::push_back() to add the prepared Pitcher to your vector.
Test point: test your code by displaying the name and number of wins in each vector element.
Write function bool compare_pitchers() that compares the ERA of two Pitcher instances. You will use this function as an argument to std::sort().Function compare_pitchers() should take two reference parameters of type Pitcher.
compare_pitchers() should return true if the first Pitcher has a lower number of wins, false otherwise.
Call std::sort() to sort the Pitchers in your vector by ERA, lowest to highest.
Display all elements of your sorted vector. Include all data fields and format your output nicely . Sample output
What to submitSubmit your completed .cpp file. Double-check the rubric to avoid losing points.

Posted in C++