I am having some trouble getting this code into C++...Can somebody help me!

[inlinecode=cpp]
#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
int random_1();

int main()
{
int i = 0;
int j = 0;
int check;
int check_1;
char play_again = '\n' ;

int tortoise[70];
int hare[70];
cout << "BANG !!!!!" << endl;
cout << "AND THEY'RE OFF !!!!!" << endl;
while(play_again == '\n')
{
while(i <= 69 && j <= 69)
{
tortoise[i] = 0;;
check = random_1();
if(check == 1 || check == 2 || check == 3 || check == 4 || check ==
5)
tortoise[i+=3] = 0;
if(check == 6 || check == 7)
tortoise[i-=6] = 0;

if(check == 8 || check == 9 || check == 10)
tortoise[i+=1] = 0;
char *ptr;
char line[71] = "----------------------------------------------------------------------";
ptr = line;

if(i < 0){
i = 0;
*(ptr + i) = 'T';}
*(ptr + i) = 'T';
hare[j] = 0;
check_1 = random_1();
if(check_1 == 1 || check_1 == 2)
hare[j] = 0;
if(check_1 == 3 || check_1 == 4)
hare[j+=9] = 0;
if(check_1 == 5)
hare[j+=12] = 0;

if(check_1 == 6 || check_1 == 7 || check_1 == 8)
hare[j++] = 0;
if(check_1 == 9 || check_1 == 10)
hare[j-=2] = 0;

if(j < 0){
j = 0;
*(ptr + j) = 'H';}
*(ptr + j) = 'H';
if(i == j){
*(ptr + i) = 'O';
*(ptr + i + 1) = 'U';
*(ptr + i + 2) = 'C';
*(ptr + i + 3) = 'H';}
cout << "%s\n\n" << endl;
break;
}
if(i >= 69)
{
cout << "TORTOISE WINS!!! YAY!!!" << endl;
break;
}
if(j >= 69)
{
cout << "HARE WINS. YUCH." << endl;
break;
}
if(j >= 69 && i >= 69)
{
cout << "IT'S A TIE" << endl;
break;
}
cout << "Press enter" << endl;
cin >> "%c",>> &play_again); // Error Here
}
return 0;
}
int random_1()
{
srand(time(NULL));
return (1 + rand() % 10);
}

[/inlinecode = cpp]

It is c++ not c ,You dont need format specifier in this.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.