Click here to Skip to main content
15,908,274 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Display balance Pin
Sam Hobbs9-Nov-22 11:25
Sam Hobbs9-Nov-22 11:25 
AnswerRe: Display balance Pin
Gerry Schmitz9-Nov-22 19:17
mveGerry Schmitz9-Nov-22 19:17 
AnswerRe: Display balance Pin
CPallini12-Nov-22 10:39
mveCPallini12-Nov-22 10:39 
QuestionMaking VC++ 6 DLL to work on VB6 App with no UNICODE issue Pin
whiteboat27-Oct-22 19:50
whiteboat27-Oct-22 19:50 
AnswerRe: Making VC++ 6 DLL to work on VB6 App with no UNICODE issue Pin
Victor Nijegorodov27-Oct-22 20:41
Victor Nijegorodov27-Oct-22 20:41 
GeneralRe: Making VC++ 6 DLL to work on VB6 App with no UNICODE issue Pin
whiteboat27-Oct-22 21:21
whiteboat27-Oct-22 21:21 
AnswerRe: Making VC++ 6 DLL to work on VB6 App with no UNICODE issue Pin
Jeremy Falcon15-Dec-22 11:53
professionalJeremy Falcon15-Dec-22 11:53 
QuestionProgram set Pin
debby forbes21-Oct-22 17:38
debby forbes21-Oct-22 17:38 
Hello everyone. Currently, working on a program however i tried my first two programs using a driver but i still have an error. I'm not sure what the issue is. I'm new to c++ any assistance would be appreciated, Attached is the driver and 1 and 2 program. Thanks.

Driver:
#include <iostream>
using std::cout;
using std::cin;
using std::endl;

#include<cstdlib>
//#include "Miscellaneous.h"


void showMenu();
int getResponse();

int main()
{

    int response;
    

    //NOTE: each time you finish writing a function and want to test it,
    //uncomment the case within the switch that calls that function.
    while ( ( response = getResponse() ) != 5 )
    {
        switch( response )
        {

            //case 1: multiplication(); cout<<"\n\n"; break;
            //case 2: numberGuess(); cout<<"\n\n"; break;
            //case 3: printSquare(); cout<<"\n\n"; break;
            //case 4: calculatePayroll(); cout<<"\n\n"; break;
        }
        system("pause");
    }

    cout<<"\n\nThank you and have a nice day!\n\n";

    return 0;

}


void showMenu()
{

    system("cls");
    cout<<"***********************************\n";
    cout<<"* Press 1 to do multiplication    *\n";
    cout<<"* Press 2 to play number guessing *\n";
    cout<<"* Press 3 to print a square       *\n";
    cout<<"* Press 4 to calculate payroll    *\n";
    cout<<"* Press 5 to Quit                 *\n";
    cout<<"***********************************\n";
    cout<<"=====> ";

}


int getResponse()
{
    int response;
    showMenu();
    cin>> response;

    while( response < 1 || response > 5)
    {
        showMenu();
        cin >> response;
    }
    return response;


}
1 CASE: MULTIPLICATION 
<pre>#include <iostream>
using std::cout;
using std::endl;
using std::cin;
#include <cstdlib>
#include <ctime>
void correctMessage( void );
void incorrectMessage( void );
void multiplication( void );

int main()

{
srand( time( 0 ) );

multiplication();
return 0;
}

void correctMessage( void )
{
switch ( rand() % 4 ) {
case 0:
cout << "Very good!";break;
case 1:
cout << "Very good!";break;
case 2:
cout << "Very good!";break;
case 3:
cout << "Very good!";break;
}
cout << "\n\n";
}

void incorrectMessage( void )
{
switch ( rand() % 4 ) {

case 0:
cout << "No. Please try again.";break;
case 1:
cout << "No. Please try again.";break;
case 2:
cout << "No. Please try again!";break;
case 3:
cout << "No. Please try again!";break;
cout << "\n\n";
}


}

void multiplication( void )

{

int x, y, response = 0;

while ( response != -1 ) {
x = rand() % 10;
y = rand() % 10;
cout << "How much is " << x << " times " << y<< " (-1 to End)? "; cin >> response;
while ( response != -1 && response != x * y ) {
incorrectMessage();
cin >> response;
}
if ( response != -1 ) {
correctMessage();
}
}
return ;
}

CASE 2: GUESS NUMBER 
<pre>#include <ps1.h>
#include <iostream>
#include<cstdlib>



int number,guess,m,l;
double low,high,win;


int main()
{

int x=(rand() %1000)+1,guess,t=1;

cout<<" I have a number between 1 and 1000"<<endl;
cout<<" can="" you="" guess="" my="" number?"<<endl;
="" cout<<"="" please="" type="" your="" first="" guess:"<<endl;
cin="">> number;

if(guess<x)
goto low;

else="" if(guess="">x)
    goto high;

else if (guess==x)
    goto win;

cin>>low;
cout<<" Too Low"<<endl<<t++;
goto low;
cin="">>high;
cout<<" Too high" <

AnswerRe: Program set Pin
Richard MacCutchan21-Oct-22 21:39
mveRichard MacCutchan21-Oct-22 21:39 
AnswerRe: Program set Pin
CPallini24-Oct-22 22:20
mveCPallini24-Oct-22 22:20 
QuestionC++ Shellcode process returned -1073741819 (0xC0000005) Pin
Ben kubi20-Oct-22 4:56
Ben kubi20-Oct-22 4:56 
AnswerRe: C++ Shellcode process returned -1073741819 (0xC0000005) Pin
Richard MacCutchan20-Oct-22 5:41
mveRichard MacCutchan20-Oct-22 5:41 
GeneralRe: C++ Shellcode process returned -1073741819 (0xC0000005) Pin
Ben kubi20-Oct-22 5:53
Ben kubi20-Oct-22 5:53 
GeneralRe: C++ Shellcode process returned -1073741819 (0xC0000005) Pin
Victor Nijegorodov20-Oct-22 6:01
Victor Nijegorodov20-Oct-22 6:01 
GeneralRe: C++ Shellcode process returned -1073741819 (0xC0000005) Pin
Richard MacCutchan20-Oct-22 6:36
mveRichard MacCutchan20-Oct-22 6:36 
GeneralRe: C++ Shellcode process returned -1073741819 (0xC0000005) Pin
Ben kubi20-Oct-22 6:50
Ben kubi20-Oct-22 6:50 
GeneralRe: C++ Shellcode process returned -1073741819 (0xC0000005) Pin
Victor Nijegorodov20-Oct-22 10:46
Victor Nijegorodov20-Oct-22 10:46 
GeneralRe: C++ Shellcode process returned -1073741819 (0xC0000005) Pin
Ben kubi20-Oct-22 11:32
Ben kubi20-Oct-22 11:32 
GeneralRe: C++ Shellcode process returned -1073741819 (0xC0000005) Pin
Richard MacCutchan20-Oct-22 20:38
mveRichard MacCutchan20-Oct-22 20:38 
AnswerRe: C++ Shellcode process returned -1073741819 (0xC0000005) Pin
Mircea Neacsu20-Oct-22 14:04
Mircea Neacsu20-Oct-22 14:04 
AnswerRe: C++ Shellcode process returned -1073741819 (0xC0000005) Pin
Richard MacCutchan20-Oct-22 21:01
mveRichard MacCutchan20-Oct-22 21:01 
QuestionCannot initialize iterator with vector type defined in class Pin
ForNow12-Oct-22 16:40
ForNow12-Oct-22 16:40 
AnswerRe: Cannot initialize iterator with vector type defined in class Pin
CPallini12-Oct-22 21:42
mveCPallini12-Oct-22 21:42 
QuestionCreate a Makefile from this mess Pin
pkfox8-Oct-22 2:56
professionalpkfox8-Oct-22 2:56 
AnswerRe: Create a Makefile from this mess Pin
Richard MacCutchan8-Oct-22 5:34
mveRichard MacCutchan8-Oct-22 5:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.