#include <stdio.h>
#include <string.h>
#include <ctype.h>
int main( void )
{
char text[ 3 ][ 80 ],tampon[240]={0}; /* 3 lines of text */
char *searchPtr; /* pointer to search character */
char characters[ 26 ] = { 0 }; /* totals for each letter */
char say_characters[ 26 ] = { 0 };
int count = 0; /* total for current letter */
int i; /* loop counter */
int j; /* loop counter */
printf( "Enter three lines of text:\n" );
gets(text[0]);
gets(text[1]);
gets(text[2]);
strcat(tampon,text[0]);
strcat(tampon,text[1]);
strcat(tampon,text[2]); /* read three lines of text */
for(j=0;j<strlen(tampon);j++){
tampon[j]=tolower(tampon[j]);}/* convert letters to lowercase */
for(i=0;i<26;i++){
characters[i]=(char)((int)'a'+i);
}
searchPtr=tampon;
for(j=0;j<strlen(tampon);j++,searchPtr=searchPtr+1)
for(i=0;i<26;i++){
if(characters[i]==*searchPtr){
say_characters[i]++;
}
}
/* loop through alphabet */
printf( "\nThe total occurrences of each character:\n" );
/* display totals for each character */
for ( i = 0; i <= 25; i++ ) {
printf( "%c:%3d\n", 'a' + i, say_characters[ i ] );
} /* end for */
return 0; /* indicate successful termination */
} /* end main */
15 Nisan 2013 Pazartesi
5 Nisan 2013 Cuma
05.04.2013 Günü yaptığımız çalışma :)
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
#include <math.h>
#define pi 3.14
#define N 8
int main (){
int i,k,u,v,x,y;
double fxy[N][N]={0.0}, c[N][N]={0.0},z[N][N]={0.0},a[N],b[N];
srand(time(NULL));
for(x=0;x<N;x++){
for(y=0;y<N;y++){
fxy[x][y]=1;//rand() %250 +1;
}}
for(u=0;u<N;u++){
for(v=0;v<N;v++){
c[u][v]=0.0;
if(u==0)
a[u]=(double)(1/sqrt(2.0));
else
a[u]=1.0;
if(v==0)
b[v]=(double)(1/sqrt(2.0));
else
b[v]=1.0;
for(x=0;x<N;x++){
for(y=0;y<N;y++){
c[u][v]+=fxy[x][y]*cos((double)((double)(2*x+1)*(double)u*(double)pi/(double)(2*N)))*cos((double)((double)(2*y+1)*(double)v*(double)pi/(double)(2*N)));
}}
c[u][v]*=((double)(2.0/N)*(double)a[u]*(double)b[v]);
printf("%d,%d = %.3lf\t",u+1,v+1,c[u][v]);
}}
printf("\n");
for(u=0;u<N;u++){
for(v=0;v<N;v++){
for(x=0;x<N;x++){
for(y=0;y<N;y++){
z[u][v]+=c[x][y]*a[u]*b[v]*cos((double)((double)(2*x+1)*(double)u*(double)pi/(double)(2*N)))*cos((double)((double)(2*y+1)*(double)v*(double)pi/(double)(2*N)));
}}
z[u][v]*=(double)(2.0/N);
printf("%d,%d = %.3lf\t",u+1,v+1,z[u][v]);
}}
}
#include <time.h>
#include <stdlib.h>
#include <math.h>
#define pi 3.14
#define N 8
int main (){
int i,k,u,v,x,y;
double fxy[N][N]={0.0}, c[N][N]={0.0},z[N][N]={0.0},a[N],b[N];
srand(time(NULL));
for(x=0;x<N;x++){
for(y=0;y<N;y++){
fxy[x][y]=1;//rand() %250 +1;
}}
for(u=0;u<N;u++){
for(v=0;v<N;v++){
c[u][v]=0.0;
if(u==0)
a[u]=(double)(1/sqrt(2.0));
else
a[u]=1.0;
if(v==0)
b[v]=(double)(1/sqrt(2.0));
else
b[v]=1.0;
for(x=0;x<N;x++){
for(y=0;y<N;y++){
c[u][v]+=fxy[x][y]*cos((double)((double)(2*x+1)*(double)u*(double)pi/(double)(2*N)))*cos((double)((double)(2*y+1)*(double)v*(double)pi/(double)(2*N)));
}}
c[u][v]*=((double)(2.0/N)*(double)a[u]*(double)b[v]);
printf("%d,%d = %.3lf\t",u+1,v+1,c[u][v]);
}}
printf("\n");
for(u=0;u<N;u++){
for(v=0;v<N;v++){
for(x=0;x<N;x++){
for(y=0;y<N;y++){
z[u][v]+=c[x][y]*a[u]*b[v]*cos((double)((double)(2*x+1)*(double)u*(double)pi/(double)(2*N)))*cos((double)((double)(2*y+1)*(double)v*(double)pi/(double)(2*N)));
}}
z[u][v]*=(double)(2.0/N);
printf("%d,%d = %.3lf\t",u+1,v+1,z[u][v]);
}}
}
2 Nisan 2013 Salı
Matrislerin toplamı, Skalerle Çarpımı ve Transpozesi
#include<stdio.h> /* gerekli olan fonksiyonları yazınız*/
void scalar_mul(int matrix[3][2],int k);
void add(int matrix1[3][2],int matrix2[3][2]);
void transpose(int matrix5[3][2]);
int main(){
int matrix1 [2][3]= {{1,0,0},{0,0,1} }, i,j;
int matrix2[3][2]={{-1,3},{6,-6},{-3,-1}};
int matrix3[3][2]={{1,-2},{-4,4},{2,1}};
int matrix4[3][2];
scalar_mul(matrix3,3);
add(matrix2,matrix3);
transpose(matrix2);
return(0);
}
void transpose(int matrix5[3][2]){
int matrix6[2][3],i,j;
printf("Bir Matrisin Transpozesi\n");
for(i=0;i<3;i++){
for(j=0;j<2;j++){
matrix6[j][i]=matrix5[i][j];
}}
for(i=0;i<2;i++){
for(j=0;j<3;j++){
printf("%d,%d: %3d\t",i+1,j+1,matrix6[i][j]);
}
printf("\n");
}
printf("\n");
}
void add(int matrix1[3][2],int matrix2[3][2]){
int i,j,tampon[3][2]={0};
printf("2 Matrisin Toplami\n");
for(i=0;i<3;i++){
for(j=0;j<2;j++){
tampon[i][j]=matrix1[i][j]+matrix2[i][j];
printf("%d,%d: %3d\t",i+1,j+1,tampon[i][j]);
}
printf("\n");
}
printf("\n");
}
void scalar_mul(int matrix[3][2],int k){
int tampon[3][2],i,j;
printf("Bir Matrisin Skalerle Carpimi\n");
for(i=0;i<3;i++){
for(j=0;j<2;j++){
tampon[i][j]=matrix[i][j]*k;
printf("%d,%d: %3d\t",i+1,j+1,tampon[i][j]);
}
printf("\n");
}
printf("\n");
}
void scalar_mul(int matrix[3][2],int k);
void add(int matrix1[3][2],int matrix2[3][2]);
void transpose(int matrix5[3][2]);
int main(){
int matrix1 [2][3]= {{1,0,0},{0,0,1} }, i,j;
int matrix2[3][2]={{-1,3},{6,-6},{-3,-1}};
int matrix3[3][2]={{1,-2},{-4,4},{2,1}};
int matrix4[3][2];
scalar_mul(matrix3,3);
add(matrix2,matrix3);
transpose(matrix2);
return(0);
}
void transpose(int matrix5[3][2]){
int matrix6[2][3],i,j;
printf("Bir Matrisin Transpozesi\n");
for(i=0;i<3;i++){
for(j=0;j<2;j++){
matrix6[j][i]=matrix5[i][j];
}}
for(i=0;i<2;i++){
for(j=0;j<3;j++){
printf("%d,%d: %3d\t",i+1,j+1,matrix6[i][j]);
}
printf("\n");
}
printf("\n");
}
void add(int matrix1[3][2],int matrix2[3][2]){
int i,j,tampon[3][2]={0};
printf("2 Matrisin Toplami\n");
for(i=0;i<3;i++){
for(j=0;j<2;j++){
tampon[i][j]=matrix1[i][j]+matrix2[i][j];
printf("%d,%d: %3d\t",i+1,j+1,tampon[i][j]);
}
printf("\n");
}
printf("\n");
}
void scalar_mul(int matrix[3][2],int k){
int tampon[3][2],i,j;
printf("Bir Matrisin Skalerle Carpimi\n");
for(i=0;i<3;i++){
for(j=0;j<2;j++){
tampon[i][j]=matrix[i][j]*k;
printf("%d,%d: %3d\t",i+1,j+1,tampon[i][j]);
}
printf("\n");
}
printf("\n");
}
Kaydol:
Kayıtlar (Atom)