Showing posts with label keyboard. Show all posts
Showing posts with label keyboard. Show all posts

Friday, February 13, 2015

C program which reads your name from the keyboard and outputs a list of ASCII codes which represent your name

C program which reads your name from the keyboard and outputs a list of ASCII codes which represent your name

#include<stdio.h>
#include<conio.h>

void main()
{
int i;
char name[50];
clrscr();
printf("Enter your name: ");
gets(name);
printf("
Character ASCII Code");


for(i=0;name[i]!=
Read more »

C program to read a matrix of size mxn from the keyboard and display the same on the screen

C++ program to read a matrix of size mxn from the keyboard and display the same on the screen

#include<iostream.h>
#include<conio.h>

void main()
{
clrscr(); //to clear the screen
int a[5][5],n,m,i,j;
cout<<"Enter value of m and n:";
cin>>m>>n;
cout<<"
Enter elemets of the matrix:
";


for(i=0;i<m;++i)
for(j=0;j<n;++j)
cin>>a[i][j];
cout<<"
The Matrix is:
";

for(i=0;i<m;++i)
{
for(j=0;j<n;++j)
cout<<a[i][j]<<" ";
cout<<"
";

}
getch(); //to stop the screen
}
Read more »