#include "stdafx.h"
#include <iostream>
#include <conio.h>
#include<stdlib.h>
#include <math.h>
#include <time.h>
#include<iomanip>;
using namespace std;
const int row=5;
const int col=7;
static const char zin[]="0123456789""abcdefghijklmnopqrstuvwxyz""!<>)(*&^%%$#@!";
int _tmain(int argc, _TCHAR* argv[])
{
time_t t;
srand (time(&t));
char mat[row][col];
int i,j;
char arr[50];
char taw[50];
int b=0;
for(i=0;i<row;i++)
{
for(j=0;j<col;j++)
{
mat[i][j] =zin[rand()%(sizeof(zin)-1)];
//mat[i][j] =rand()% 200-100;
cout<<setw(4)<<mat[i][j];
}
cout<<endl;
cout<<endl;
}
cout<<endl; cout<<endl; cout<<endl;
for(j=0;j<col;j++)
{
for(i=0;i<row;i++)
{
if( !(mat[i][j]>='a'&& mat[i][j]<='z') && !(mat[i][j]>='0' && mat[i][j]<='9'))
{
taw[b++]=mat[i][j];
}
}
cout<<b<<endl;
b=0;
}
/*
for(i=0;i<b;i++)
{
cout<<setw(5)<<taw[i];
}
*/
getch();
return 0;
}
No comments:
Post a Comment