#include "stdafx.h"
#include <iostream>
#include <Windows.h>
#include <conio.h>
#include <string>
// Define colors
void setColor(int e) {
SetConsoleTextAttribute(GetStdHandle (STD_OUTPUT_HANDLE), e);
}
// Define pause
void pause() {
_getch();
}
// Define clear
void clear() {
system("CLS");
}
// Define spacer (\n)
void _space(std::string i = "\n") {
using namespace std;
using std::string;
cout << i;
}
// Define spacer2 (\n\n)
void _space2(std::string l = "\n") {
using namespace std;
using std::string;
cout << l << endl;
}
// Define text
void printText(std::string e) {
using namespace std;
using std::string;
cout << e;
}
// Define directions
void dir_init() {
setColor(14);
printText("Press A to say hello world!"); _space();
printText("Press B to say Hello World!!"); _space();
printText("Press C to say Hellow world!!!"); _space();
}
// Define header
void _header() {
setColor(12);
printText("========================= ::: "); printText("Name of Application"); printText(" ::: ========================="); _space();
printText("Build <number>"); _space();
printText("Created By: <name>"); _space();
printText("================================================================================");
_space2();
dir_init();
}
// Button handling
void but_init() {
char ch;
while(true) {
ch = _getch();
if (ch == 'a' || ch == 'A' {
printText("hello world!"); _space();
}
else if(ch == 'b' || ch == 'B' {
printText("Hello World!!"); _space();
}
else if(ch == 'c' || ch == 'C' {
printText("Hello world!!!"); _space();
}
else {
clear();
printText("Please press the correct options from the menu!"); _space2(); _space2();
_header();
}
}
pause();
}
int main() {
using namespace std;
SetConsoleTitle(L"Title of the console ie: app name");
_header();
but_init();
return 0;
}
#include "stdafx.h"
#include <iostream>
#include <Windows.h>
#include <conio.h>
#include <string>
// Define colors
void setColor(int e) {
SetConsoleTextAttribute(GetStdHandle (STD_OUTPUT_HANDLE), e);
}
// Define pause
void pause() {
_getch();
}
// Define clear
void clear() {
system("CLS");
}
// Define spacer (\n)
void _space(std::string i = "\n") {
using namespace std;
using std::string;
cout << i;
}
// Define spacer2 (\n\n)
void _space2(std::string l = "\n") {
using namespace std;
using std::string;
cout << l << endl;
}
// Define text
void printText(std::string e) {
using namespace std;
using std::string;
cout << e;
}
// Define directions
void dir_init() {
setColor(14);
printText("Press A to say hello world!"); _space();
printText("Press B to say Hello World!!"); _space();
printText("Press C to say Hellow world!!!"); _space();
}
// Define header
void _header() {
setColor(12);
printText("========================= ::: "); printText("Name of Application"); printText(" ::: ========================="); _space();
printText("Build <number>"); _space();
printText("Created By: <name>"); _space();
printText("================================================================================");
_space2();
dir_init();
}
// Button handling
void but_init() {
char ch;
while(true) {
ch = _getch();
if (ch == 'a' || ch == 'A' {
printText("hello world!"); _space();
}
else if(ch == 'b' || ch == 'B' {
printText("Hello World!!"); _space();
}
else if(ch == 'c' || ch == 'C' {
printText("Hello world!!!"); _space();
}
else {
clear();
printText("Please press the correct options from the menu!"); _space2(); _space2();
_header();
}
}
pause();
}
int main() {
using namespace std;
SetConsoleTitle(L"Title of the console ie: app name");
_header();
but_init();
return 0;
}
#include <iostream>
using namespace std;
void opt1();
void opt2();
void opt3();
void opt4();
void opt5();
void (*options[5])()=
{
opt1,opt2,opt3,opt4,opt5
};
int main()
{
int ans;
cout << "Welcome to the menu system\npress 1 -- say hello world!\npress 2 -- say hello word!\npress 3 -- say hello word!\npress 4 -- say hello word!\npress 2 -- say hello word!\nEnter Choice: ";
cin>>ans;
switch(ans)
{
case 1: options[0]();
system("pause>nul");
break;
case 2: options[1]();
system("pause>nul");
break;
case 3: options[2]();
system("pause>nul");
break;
case 4: options[3]();
system("pause>nul");
break;
case 5: options[4]();
system("pause>nul");
break;
return 0;
}
}
void opt1()
{
cout<<"Hello, World!"<<endl;
}
void opt2()
{
cout<<"Hello, World!"<<endl;
}
void opt3()
{
cout<<"Hello, World!"<<endl;
}
void opt4()
{
cout<<"Hello, World!"<<endl;
}
void opt5()
{
cout<<"Hello, World!"<<endl;
}
#include <iostream>
using namespace std;
void opt1();
void opt2();
void opt3();
void opt4();
void opt5();
void (*options[5])()=
{
opt1,opt2,opt3,opt4,opt5
};
int main()
{
int ans;
cout << "Welcome to the menu system\npress 1 -- say hello world!\npress 2 -- say hello word!\npress 3 -- say hello word!\npress 4 -- say hello word!\npress 2 -- say hello word!\nEnter Choice: ";
cin>>ans;
switch(ans)
{
case 1: options[0]();
system("pause>nul");
break;
case 2: options[1]();
system("pause>nul");
break;
case 3: options[2]();
system("pause>nul");
break;
case 4: options[3]();
system("pause>nul");
break;
case 5: options[4]();
system("pause>nul");
break;
return 0;
}
}
void opt1()
{
cout<<"Hello, World!"<<endl;
}
void opt2()
{
cout<<"Hello, World!"<<endl;
}
void opt3()
{
cout<<"Hello, World!"<<endl;
}
void opt4()
{
cout<<"Hello, World!"<<endl;
}
void opt5()
{
cout<<"Hello, World!"<<endl;
}
#include <iostream>
using namespace std;
void opt1();
void opt2();
void opt3();
void opt4();
void opt5();
void (*options[5])()=
{
opt1,opt2,opt3,opt4,opt5
};
int main()
{
int ans;
cout << "Welcome to the menu system\npress 1 -- say hello world!\npress 2 -- say hello word!\npress 3 -- say hello word!\npress 4 -- say hello word!\npress 2 -- say hello word!\nEnter Choice: ";
cin>>ans;
switch(ans)
{
case 1: options[0]();
system("pause>nul");
break;
case 2: options[1]();
system("pause>nul");
break;
case 3: options[2]();
system("pause>nul");
break;
case 4: options[3]();
system("pause>nul");
break;
case 5: options[4]();
system("pause>nul");
break;
return 0;
}
}
void opt1()
{
cout<<"Hello, World!"<<endl;
}
void opt2()
{
cout<<"Hello, World!"<<endl;
}
void opt3()
{
cout<<"Hello, World!"<<endl;
}
void opt4()
{
cout<<"Hello, World!"<<endl;
}
void opt5()
{
cout<<"Hello, World!"<<endl;
}
Copyright © 2024, NextGenUpdate.
All Rights Reserved.