#include <cmath>
#include <iostream>
using namespace std;
void Cipher(string str)
{
int r, c;
for (int i = 0; str; i++)
{
r = ceil((str - 'a') / 5) + 1;
c = ((str - 'a') % 5) + 1;
if (str == 'k')
{
r = r - 1;
c = 5 - c + 1;
}
else if (str >= 'j')
{
if (c == 1)
{
c = 6;
r = r - 1;
}
c = c - 1;
}
cout << r << c;
}
cout << endl;
}
int main()
{
string str = "nsit";
Cipher(str);
}
a) 33344244
b) 44332434
c) 33432444
d) 11444323
What will be the output of the following C++ code?
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
What will be the output of the following C++ code?
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!