Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  pi
Language: C/C++
Code:
#include <iostream>
#include <string>
#include <stdio.h>
#include <cstdio>
#include <time.h>
#include <Windows.h>
using namespace std;
string name="name";
int pi []={1,4,1,5,9,2,6,5,3,5,8,9,7,9,3,2,3,8,4,6,2,6,4,3,3,8,3,2,7,9,5,0,2,8,8,4,1,9,7,1,6,9,3,9,9,3,7,5,1,0,5,8,2,0,9};
int temp=0;
int main()
{
     cout << "Welcome to Mempi! Press any key to begin." << endl;
     cin.get();
     for(int a=0;a<50;a++)
     {
          cout << "Digit number " << a+1 << ":";
          cin >> temp;
          if (temp!=pi[a])
          {
               cout << "NO YOU MESSED UP!!!" << endl;
               cout << "Score:" << a << endl;
               cout << "Next 4 digits:" << pi[a] << pi[a+1] << pi[a+2] << pi[a+3] << endl;
               system("pause");
               return 0;
          }
     }
     cout << "Yay, you know 50 digits of pi!" << endl;
     system("pause");
     return 0;
}
Comments: