+ 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;
2 Respostas
+ 15
Change int to char as the data type of the 2D array
+ 3
thank you... it worked 👍