Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Krishprtest #8

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 25 additions & 2 deletions HelloWorld.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,33 @@
#include <Speaker.h>
#include <cstdlib> // for rand() and srand()
#include <ctime> // for time()

using namespace std;
using namespace Hello;

int main(int argc, char *argv[]) {
Speaker* speaker = new Speaker();
// Initialize random seed
srand(static_cast<unsigned int>(time(0)));

speaker->sayHello();
// Array of random greetings
const char* greetings[] = {
"Hello!",
"Hi there!",
"Greetings!",
"Salutations!",
"Howdy!"
};

// Select a random greeting
int randomIndex = rand() % (sizeof(greetings) / sizeof(greetings[0]));
const char* randomGreeting = greetings[randomIndex];

Speaker* speaker = new Speaker();

// Use the random greeting in some way
cout << randomGreeting << endl; // Print the random greeting
speaker->sayHello(); // Call sayHello method

delete speaker; // Clean up
return 0;
}
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,10 @@ Removing the application is straight-forward. Simply delete the binary 'CMakeHe

***Caution***
I am a complete C++ noob. I've created this project as part of an effort to kickstart my C++ recovery as I have recently been placed on a team which is developing an embedded application. There may be any number of things wrong with this example. If you see something you know to be implemented incorrectly please contact me via github and I will do my best to correct it. Better, fork the project, fix it and issue a pull request.
***Uninstallation***
Removing the application is straight-forward. Simply delete the binary 'CMakeHelloWorld' from /usr/local/bin.


***Caution***
I am a complete C++ noob. I've created this project as part of an effort to kickstart my C++ recovery as I have recently been placed on a team which is developing an embedded application. There may be any number of things wrong with this example. If you see something you know to be implemented incorrectly please contact me via github and I will do my best to correct it. Better, fork the project, fix it and issue a pull request.

Loading