24 Aralık 2018 Pazartesi

Javascript Toplama İşlemi

<!DOCTYPE html>
<html lang="tr">
<head>
    <meta charset="utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
</head>
<style>
</style>
<body>
 
    <p><input type="text" id="veri1" name="veri1"></p>
    <p><input type="text" id="veri2" name="veri2"></p>
    <p id="demo"></p>
    
<script type="text/javascript">
    var result=document.getElementById("demo");
    times=setInterval(toplam, 1000);
    function toplam(){
        var data1, data2,sonuc;
        data1=Number(document.getElementById("veri1").value);
        data2=Number(document.getElementById("veri2").value);
        sonuc=data1+data2;
        result.innerHTML=sonuc;
    }
</script>
</body>
</html>

19 Aralık 2018 Çarşamba

Javascript ile Tek Sayıları Ekrana Yazdırma

<!DOCTYPE html>
<html lang="tr">
<head>
    <meta charset="utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
</head>
<style>
</style>
<body>
    <input type="text" value="0" id="deger">
    <button type="button" onclick="eylem()">Click Me</button>
    <p id="result"></p>
 
<script type="text/javascript">
 
    function eylem(){
    var x= Number(document.getElementById("deger").value);
    var text=" ";
    var i;
    for(i=0; i<=x; i++){
        if(i%2==0){
           continue;
        }
        text +=i+"<br>"
    }
    document.getElementById("result").innerHTML=text;
    }
</script>
</body>
</html>

Javascript Yön Tuşları Kullanma

<!doctype html>
<html>
<head>
    <meta charset="utf-8">
</head>
<body id="bdy">
<style>
    #Container{
        box-sizing: border-box;
        width: 600px;
        height: 600px;
        border: 3px solid gray;
        position: relative;
    }
    #Container #ContainerInside{
        box-sizing: border-box;
        width: 48px;
        height: 48px;
        background-color:yellow;
        position: absolute;
    }
</style>
 
    Sonuc:
    <input type="button" value="0" id="sonuc">
    <input type="button" value="0" id="sonuc1">
    <div id="Container">
        <div id="ContainerInside"></div>
    </div>
 
<script>
   
    var pos1=0, pos2=0;
    document.onkeydown=function keyKontrol(e){
    var keyKod=e.which;
     
    var box= document.getElementById("ContainerInside");
    var tuval= document.getElementById("Container");
    var sonuc= document.getElementById("sonuc");
    var sonuc1= document.getElementById("sonuc1");
 
        if(keyKod == 37){
        if(pos1>0)
        sonuc.value=Number(sonuc.value)-50;
        pos1= sonuc.value;
        box.style.left= pos1 + "px";
        console.log("37: "+pos1);
        }
     
        if(keyKod == 38){
        if(pos2>0)
        sonuc1.value=Number(sonuc1.value)-50;
        pos2= sonuc1.value;
        box.style.top= pos2 + "px";
        console.log("38: "+pos2);
        }
     
        if(keyKod == 39){
        if(pos1<550)
        sonuc.value=Number(sonuc.value)+50;
        pos1= sonuc.value;
        box.style.left= pos1 + "px";
        console.log("39: "+pos1);
        }
     
        if(keyKod == 40){
        if(pos2<550)
        sonuc1.value=Number(sonuc1.value)+50;
        pos2= sonuc1.value;
        box.style.top= pos2 + "px";
        console.log("40: "+pos2);
        }
        console.log("sonuc1: "+sonuc.value);
        console.log("sonuc2: "+sonuc1.value);
     }
</script>
</body>
</html>

11 Ağustos 2018 Cumartesi

C ile İki boyutlu Matris

#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>

/* A matrisi icin:  a[satir][sutun] */

int main(){

   int i, j, boyut, q, say=1, a[15][15];

   printf("Matrisin boyutu giriniz: ");
   scanf("%d", &boyut);

   if(boyut>15 || boyut<2){
    printf("Girdiginiz rakam 2 ile 15 arasinda olmali");
   }
   //tum rakamlari sifirla
   for(i=0; i<boyut; i++){
    for(j=0; j<boyut; j++){
        a[i][j]=0;
    }
   }

   // hepsini dondur
   for(q=0; q<=boyut/2; q++){
   // 1-ci satiri numarala a[0][j]
    for(j= 0+q; j<boyut-q; j++){
        a[0+q][j]= say;
        say++;
    }
 
   }
   // Ekrana yazdir
   for(i=0; i<boyut; i++){
    for(j=0; j<boyut; j++){
        printf("%d\t", a[i][j]);
    }
    printf("\n");
   }

   return 0;
}

16 Temmuz 2018 Pazartesi

Kullanıcıdan Karakter Uzunlugu Alıp Ekrana Bastırma


#include <stdio.h>
#include <stdlib.h>

char* yaziGirisi(int);

int main(){
 
int yaziBoyutu, i;

printf("Yazinin uzunlugunu giriniz: ");
fscanf(stdin, "%u", &yaziBoyutu);
fgetc(stdin);

char* tut= yaziGirisi(yaziBoyutu);

for(i=0; i<yaziBoyutu; i++){
fprintf(stdout, "%c\n", tut[i]);
}

free(tut);

return 0;
}

char* yaziGirisi(int boyut){

char* string= (char*) malloc(sizeof(char)*boyut);
fprintf(stdout, "Yazi giriniz: ");
fgets(string, boyut+1, stdin);

return string;
}

4 Haziran 2018 Pazartesi

C ile Hesap Makinası Programlama

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

void menu();
int i, n;
int addition(int* );
int subtraction(int*);
int multiplication(int*);
double divide(int*);

int main(int argc, char* argv)
{
menu();
char secim;
char sorgu;
int sayi[2];
int sonuc=0;
//Kalin ayrac cizgi
for(i=0; i<60; i++)
    {
        printf("\xdb");
    }
    //Reng verme
    system("color 9a");
    printf("\n");
    printf("\nBaslamak icin herhangi bir tusa basiniz.\n");
    getch();
    system("cls");
    printf("\n");
 
    for(i=0; i<60; i++)
    {
    printf("\xdb");
}
system("color 6b");

printf("\nHos Geldiniz\n");
for(i=0; i<60; i++)
{
printf("\xdb");
}
printf("\nHesaplma islemi yapiliyor.\n");
for(i=0; i<60; i++)
{
printf(".");
Sleep(30);
}
printf("\n");

22 Mayıs 2018 Salı

C ile Öğrenci Bilgilerini Dosyaya Yazdirma

#include <stdio.h>
#include <stdlib.h>

struct ogrenci{
    char *ad[20];
    char *soyad[20];
    char *bolum[20];
    int sinif;
    int sinav1;
    int sinav2;
    float NOTort;
};

int main()
{
    FILE *fp;
    struct ogrenci ogr;
    int n,  toplam=0;

    if((fp =fopen("bilgi.txt", "a+"))==NULL){
    puts("Ogrenci bilgi dosyasi bulunamadi");
    exit(1);
    }

    printf("Lutfen ogrenci sayisini giriniz:");
    scanf("%d", &n);

   // Hafızadan dinamik bellek ayırtmak.
    fp=calloc(n, sizeof(struct ogrenci));

    //fprintf(fp, "Adi\tSoyadi \tBolum \tSinifi \tSinav1 \tSinav2 \tOrt\n");
    while(n>0)
    {
        printf("Ogrenci ad: ");
        scanf("%s",ogr.ad);
        printf("Ogrenci soyadi: ");
        scanf("%s",ogr.soyad);
        printf("Ogrenci bolum: ");
        scanf("%s",ogr.bolum);
        printf("Ogrenci sinifi: ");
        scanf("%d",&ogr.sinif);
        printf("Ogrenci sinavi1: ");
        scanf("%d",&ogr.sinav1);
        printf("Ogrenci sinavi2: ");
        scanf("%d",&ogr.sinav2);

        toplam = (ogr.sinav1 + ogr.sinav2);
        ogr.NOTort = (float)toplam /2;
        fprintf(fp, "%s\t%s\t%s\t%d\t%d\t%3\t%.2f\n", ogr.ad, ogr.soyad, ogr.bolum, ogr.sinif,  ogr.sinav1, ogr.sinav2, ogr.NOTort);
        n--;
    }


    fclose(fp);
    return 0;
}

Python Pyqt5 ile Hesap Makinası

from PyQt5.QtWidgets import * from PyQt5.QtGui import * from mainUI import * from PyQt5.QtCore import * import sys # ----------------------U...