+ 2

How can I print ABC... Instead of their ASCII value?

#include <iostream> #include <conio.h> using namespace std; int main() { int i,j,n; int a[10][10]; char ch='A'; cin>>n; for(int i=0;i<n;i++) { for(int j=0;j<n;j++) { a[i][j]=ch; } ch++; } cout<<endl<<endl<<endl; for(int i=0;i<n;i++) { for(int j=0;j<n;j++) { if(i>=j) cout<<a[i][j]<<"\t"; } cout<<endl<<endl;

28th Mar 2017, 3:11 PM
Ajay Kumar Singh
Ajay Kumar Singh - avatar
2 Respostas
+ 15
Change int to char as the data type of the 2D array
28th Mar 2017, 3:41 PM
Shamima Yasmin
Shamima Yasmin - avatar
+ 3
thank you... it worked 👍
28th Mar 2017, 3:43 PM
Ajay Kumar Singh
Ajay Kumar Singh - avatar