my prog

craps casins

Page 1 of 1

4 Replies - 1143 Views - Last Post: 19 October 2001 - 10:17 PM Rate Topic: -----

#1 ivy  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 18-October 01

my prog

Posted 18 October 2001 - 09:28 PM

#include <iostream.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#include <iomanip.h>
#include <ctype.h>
#include <string.h>
#include <fstream.h>
#include <stdio.h>

int num1, num2, number, tot;
char mp, nmp, ans, ans2;    
void header_title();
void do_again();
void generator();
void one();
void two();
void three();
void four();
void five();
void six();
void numbers();
void generator2();
void match();
void no_match();

int main()
{
header_title();

return 0;
}

void header_title()
{
cout << " Ivy Luchetti
";
cout << " Class: Computer C++, RRHS
";
cout << " Instructor: Mr. H block 3
";
cout << " Program #3: Random Generator Number
";
cout << " Purpose: create a simulated number game
";
cout << " _______________________________________________________________________
";
do_again();
}
void do_again()
{
do
{
cout <<" Do you want to play the Generator game
";
cout <<" Type y or n and then press enter
";
cin >> ans;
cin.ignore (80,'
');
switch(ans)
{
case 'y':
case 'Y':
break;
case 'n':
case 'N':  
cout << "Goodbye please play again
";
exit(1);
break;
default:
cout << "Follow directions yes or no
";
break;
}
}while (ans!='y');
numbers();
}


#moderation mode printed the code more than once. And gave the whole program.

(Edited by runtime error at 1:14 am on Oct. 19, 2001)

(Edited by runtime error at 1:18 am on Oct. 19, 2001)


Is This A Good Question/Topic? 0
  • +

Replies To: my prog

#2 blutrane  Icon User is offline

  • 私もクールです

Reputation: 25
  • View blog
  • Posts: 1,934
  • Joined: 17-May 01

Re: my prog

Posted 18 October 2001 - 09:51 PM

use cin.get and strcmp

do{
cin.get(ans2, 3);
cin.ignore (80,'
');
if (((strcmp(ans2,"nmp")==0))||((strcmp(ans2,"NMP")==0)))
{no_match(); }
else
{cout<<"ERROR, follow directions
";}
}while ((ans2!="mp")||(ans2!="nmp");


you should call a seperate function for prompting the user for nmp and mp

use a do loop in the no_match function
so the program kicks back to the top to compare the dice to the if statements

(Edited by blutrane at 2:56 am on Oct. 19, 2001)

Was This Post Helpful? 0
  • +
  • -

#3 runtime error  Icon User is offline

  • Lucky.Code
  • member icon

Reputation: 3
  • View blog
  • Posts: 629
  • Joined: 19-March 01

Re: my prog

Posted 18 October 2001 - 10:21 PM

hey ivy welcome to dreamincode i am runtime error a local c++ mod.

What is your question about your program?

Just a couple of rules. Just post some of your code not all of your. We don't want to give your classmates the answer;)

try to post the code with a question or tell us what error you are getting.

p.s. sorry i had to edit you post but it gave the answer.

Was This Post Helpful? 0
  • +
  • -

#4 skyhawk133  Icon User is offline

  • Head DIC Head
  • member icon

Reputation: 1868
  • View blog
  • Posts: 20,280
  • Joined: 17-March 01

Re: my prog

Posted 19 October 2001 - 10:37 AM

Thanks runtime, glad to see the help!

As a side note, I think the students are getting some good help from this forum, good call last year on putting this on the site :)

Was This Post Helpful? 0
  • +
  • -

#5 blutrane  Icon User is offline

  • 私もクールです

Reputation: 25
  • View blog
  • Posts: 1,934
  • Joined: 17-May 01

Re: my prog

Posted 19 October 2001 - 10:17 PM

actually everyone already had the answer but yea people are starting to come here for help, tis good
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1