i have to write a code for polybius square
and this is what ive got right now.. im stuck on the coordinates part
#ifndef POLYBIUS_H
#define POLYBIUS_H
#include <string>
#include <iostream>
using namespace std;
typedef char square[6][6];
char Uppercase(char c);
int main ()
{
int i=0;
char str[]="Test String.\n";
char c;
while (str[i])
{
c=str[i];
if (isupper(c)) c=tolower(c);
putchar (c);
i++;
}
return 0;// returns uppercased letters
}
string convert(string str_in)
{
for(int i = 0; i < str_in.length(); i++)
{
switch(str_in[i])
{
case 'J':
str_in[i] = "I"';
break;
}
}
return str_in; // j and J are replaced by I
// returns other characters unchanged
}
void GetCoordinates(square S,
char c,
int& Digit1,
int& Digit2);
char GetCharacter(square s,
int digit1,
int digit2);
bool InSquare(square s, char c);
void FillSquare(square s,
string keyword);
// should uppercase all letters in keyword
// change all Js to Is
// ignore nonletters
void Put(square s);
// display S on screen
#endif
Last edited on