C error olmamasına rağmen output boş

Quinttet

Hectopat
Katılım
10 Ağustos 2019
Mesajlar
131
Daha fazla  
Cinsiyet
Erkek
Bir hata gözükmemesine rağmen boş çıkıyor. Nereyi yanlış yapıyorum?

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

int tuiton_fee(int student_id, int credit, int year, double tuiton_0, double tuiton_1);

int main()
{
 int student_id, credit, year;

 printf("Enter the student id (-1 to exit): ");
 scanf_s("%d", &student_id);

 if (student_id == -1)
 {
 exit(0);
 }

 printf("Enter the credit: ");
 scanf_s("%d", &credit);

 printf("Enter year: ");
 scanf_s("%d", &year);

 double tuiton_0 = 525 * credit;
 double tuiton_1 = 4500 + (750 * credit);

 int tuiton_fee(int student_id, int credit, int year, double tuiton_0, double tuiton_1);

 return 0;
}

int tuiton_fee(int student_id, int credit, int year, double tuiton_0, double tuiton_1)
{
 if (credit <= 12)
 {
 if (year == 4)
 {
 printf("Student with id %d will pay tuiton %.0lf$", student_id, tuiton_0);
 }
 else.
 {
 printf("Student with id %d will pay tuiton %.0lf$", student_id, tuiton_0 * 0.15);
 }
 }
 else if (credit > 12)
 {
 if (year == 4)
 {
 printf("Student with id %d will pay tuiton %lf$", student_id, tuiton_1);
 }
 else.
 {
 printf("Student with id %d will pay tuiton %.0lf$", student_id, tuiton_1 * 0.15);
 }
 }
 return credit;
}
 
Son düzenleyen: Moderatör:
C:
#include <stdio.h>
#include <stdlib.h>

int tuiton_fee(int student_id, int credit, int year, double tuiton_0, double tuiton_1);

int main()
{
 int student_id, credit, year;

 printf("Enter the student id (-1 to exit): ");
 scanf("%d", &student_id);

 if (student_id == -1)
 {
 exit(0);
 }

 printf("Enter the credit: ");
 scanf("%d", &credit);

 printf("Enter year: ");
 scanf("%d", &year);

 double tuiton_0 = 525 * credit;
 double tuiton_1 = 4500 + (750 * credit);

 int tuiton_fee(int student_id, int credit, int year, double tuiton_0, double tuiton_1);

 return 0;
}

int tuiton_fee(int student_id, int credit, int year, double tuiton_0, double tuiton_1)
{
 if (credit <= 12)
 {
 if (year == 4)
 {
 printf("Student with id %d will pay tuiton %.0lf$", student_id, tuiton_0);
 }
 else
 {
 printf("Student with id %d will pay tuiton %.0lf$", student_id, tuiton_0 * 0.15);
 }
 }
 else if (credit > 12)
 {
 if (year == 4)
 {
 printf("Student with id %d will pay tuiton %lf$", student_id, tuiton_1);
 }
 else
 {
 printf("Student with id %d will pay tuiton %.0lf$", student_id, tuiton_1 * 0.15);
 }
 }
 return credit;
}
Hocam elselerdeki . noktaları ve scanf_s yerine direk scanf kullandıktan sonra çalışmakta bende neden scanf_s kullanıyorsunuz?
 
Visual Studio'da çalışmıyor maalesef.

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

int tuiton_fee(int student_id, int credit, int year, double tuiton_0, double tuiton_1);

int main()
{
 int student_id, credit, year;

 printf("Enter the student id (-1 to exit): ");
 scanf("%d", &student_id);

 if (student_id == -1)
 {
 exit(0);
 }

 printf("Enter the credit: ");
 scanf("%d", &credit);

 printf("Enter year: ");
 scanf("%d", &year);

 double tuiton_0 = 525 * credit;
 double tuiton_1 = 4500 + (750 * credit);

 int tuiton_fee(int student_id, int credit, int year, double tuiton_0, double tuiton_1);

 return 0;
}

int tuiton_fee(int student_id, int credit, int year, double tuiton_0, double tuiton_1)
{
 if (credit <= 12)
 {
 if (year == 4)
 {
 printf("Student with id %d will pay tuiton %.0lf$", student_id, tuiton_0);
 }
 else.
 {
 printf("Student with id %d will pay tuiton %.0lf$", student_id, tuiton_0 * 0.15);
 }
 }
 else if (credit > 12)
 {
 if (year == 4)
 {
 printf("Student with id %d will pay tuiton %lf$", student_id, tuiton_1);
 }
 else.
 {
 printf("Student with id %d will pay tuiton %.0lf$", student_id, tuiton_1 * 0.15);
 }
 }
 return credit;
}
Hocam elselerdeki. Noktaları ve scanf_s yerine direk scanf kullandıktan sonra çalışmakta bende neden scanf_s kullanıyorsunuz?
 
1670879557527.png

Çalışıyor hocam.
 

Technopat Haberler

Yeni konular

Geri
Yukarı