PLEASE USE C PROGRAMING AND KINDLY ERASE MY POST The project

PLEASE USE C++ PROGRAMING AND KINDLY ERASE MY POST!

The project: Create a version of \"Pico Fermi Bagel.\" (Please use C ++ programming!!)

*****This program should not use arrays! ******

Your code must include a function that picks the 3-digit number with no repeated digits and a function that checks the user input.

You must write a text file with the original number in it.

And then all the player should enter a number to guess and the computer responses.

You must ask the user for the name of the file to save.

So, given the example above, the text file would look something like this:

451

120: Pico

879: Bagel

615: Pico Pico

541: Pico Pico Fermi

451: Fermi Fermi Fermi

Your code must have a function that checks for valid input (a positive 3-digit number input), and asks the user again for input if the number is not valid.

Your code needs to have a way for the user to “quit” the game.

Your code needs to have a way for the user to play again without restarting the program.  

In this case, the new game information should be added at the end of the file you have created.

*You will have analysis, pseudocode, a way to test your program for valid result, and documentation (comments) in your code.

By completing this project, you will demonstrate your understanding of:

1. Arithmetic operations (addition, subtraction, multiplication, division, modulus)

2. Conditional statements (If, If-Else, Conditional Operator, Switch)

3. Precondition, post condition, and indexing loops (Do-While, While, For)

4. Standard text file operations (open, close, read, write)

5. Modularizing code by breaking into functions (including functions with input parameters, and ones that return a specific data type)

PLEASE KINDLY ERASE MY POST!

Solution

#include<iostream>
#include <iomanip>
#include <cstdlib>
#include<fstream>

#include<string>
int main()
{
              char c,fname[10];
              ofstream out;
              cout<<\"Enter File name:\";
              cin>>fname;
              out.open(fname);
              cout<<\"Enter the number :\";
              while((c=getchar())!=\'#\')
              {
                            out<<c;
              }
            
             int number;
           int guess;
           int tries;
           char answer;
           srand(number>0);
           do
           {
                 //number=rand()%100+1;;
               cout<<\"Enter a 3 digit number\";
               cin>>guess;
           if (c<guess)
               cout<<\"Too high try again\";
               tries=1;
           } while(c>guess);
            cout<<\"Too low try again\";
            tries++;
            if(c==guess)
           cout<<\"Congratualtions!! \";
           cout<<\"You got the right number in \"<<tries<<\" tries\";
   do
   {
cout<<\"Would you like to play again? Enter Y/N\";
       cin>>answer;
    if (\'N\')
       cout<<\"Thanks for playing!\";
   } while(answer=\'Y\');
  
   out.close();
   return 0;
             // getch();
}

PLEASE USE C++ PROGRAMING AND KINDLY ERASE MY POST! The project: Create a version of \
PLEASE USE C++ PROGRAMING AND KINDLY ERASE MY POST! The project: Create a version of \

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site