fork download
  1. #include <iostream>
  2. #include<string>
  3. using namespace std;
  4.  
  5. void printSquare(string a, string b){
  6.  
  7. int start = stoi(a.substr (0, a.length()-1));
  8. int end = stoi(b.substr (0, b.length()-1));
  9. char s = a[a.length()-1];
  10. for(int i=0;i<=end-start;i++){
  11. for(int j=0;j<=end-start;j++){
  12. cout<<1+i << char(s+j);
  13. }
  14. cout<<endl;
  15. }
  16. }
  17.  
  18.  
  19. int main() {
  20. printSquare("1B", "3D");
  21. return 0;
  22. }
Success #stdin #stdout 0s 4388KB
stdin
Standard input is empty
stdout
1B1C1D
2B2C2D
3B3C3D