當前位置:首頁 » 編程軟體 » rtp編程

rtp編程

發布時間: 2023-07-19 01:06:27

1. 怎樣使用linphoneapi編程

版權聲明:本文為博主原創文章,遵循CC 4.0 BY-SA版權協議,轉載請附上原文出處鏈接和本聲明。

本文鏈接:https://blog.csdn.net/qq_33487044/article/details/104080018

2. C++ C語言程序設計 題目:貸款計算器

/*
* main.c
*
* Created on: 2011-6-8
* Author: icelights
*/

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

#define APR1 0.0747 /*<1年(含1年)年利率*/
#define APR2 0.0756 /*1-3年(含3年)年利率*/
#define APR3 0.0774 /*3-5年(含5年)年利率*/
#define APR4 0.0783 /*5年以上年利率*/
#define A_TO_M 1/12 /*月利率 = 年利率 / 12*/
#define RTP 12 /*Reimbursement total periods還款總期數 =年限*12*/
#define LENGTH 80

struct LoanInfo
{
/*姓名*/
char name[LENGTH];
/*貸款總額*/
double LoanAmount;
/*貸款年限*/
double LoanYear;
/*月付*/
double MonthlyPayment;
/*總利息*/
double TotalInterest;
/*還款總額*/
double ReimbursementAmount;
/*年利率*/
double apr;

struct LoanInfo * next;
};

void CalcShow(struct LoanInfo * cur, struct LoanInfo * hd,
struct LoanInfo * prv);

int main(void)
{
int temp;
struct LoanInfo * head = NULL;
struct LoanInfo * prev, * current;

current = (struct LoanInfo *)malloc(sizeof(struct LoanInfo));

if (NULL == head)
{
head = current;
}
else
{
prev->next = current;
}/*End of if (NULL == head)*/

puts("請輸入姓名");
gets(current->name);
fflush(stdin);

puts("請輸入貸款數額(單位:萬元)");
scanf("%lf", ¤t->LoanAmount);
fflush(stdin);

puts("請輸入貸款年限");
scanf("%lf", ¤t->LoanYear);
fflush(stdin);

printf("姓名:%s,貸款年限:%lf, 貸款數額%lf",
current->name, current->LoanYear, current->LoanAmount);

prev = current;

puts("請確認Y/N");

temp = getchar();

switch(toupper(temp))
{
case 'Y' : CalcShow(current, head, prev);
break;
case 'N' : free(current);
main();
break;
default : puts("輸入錯誤");
free(current);
break;
}

return 0;
}

void CalcShow(struct LoanInfo * cur, struct LoanInfo * hd,
struct LoanInfo * prv)
{
char lcv_temp;

if (cur->LoanYear <= 1)
cur->apr = APR1;
else if (cur->LoanYear <= 3)
cur->apr = APR2;
else if (cur->LoanYear <= 5)
cur->apr = APR3;
else
cur->apr = APR4;
/*End of if (year <= 1)*/

cur->LoanAmount = 10000 * cur->LoanAmount;
cur->ReimbursementAmount = cur->LoanAmount * pow((1 + cur->apr), cur->LoanYear);
cur->MonthlyPayment = cur->ReimbursementAmount / (cur->LoanYear * RTP);
cur->TotalInterest = cur->ReimbursementAmount - cur->LoanAmount;

printf("姓名:%s 貸款年限:%.0lf\n"
"貸款數額:%.2lf 每月還款額:%.2lf\n"
"利息合計:%.2lf 還款總額:%.2lf\n",
cur->name, cur->LoanYear, cur->LoanAmount,
cur->MonthlyPayment, cur->TotalInterest, cur->ReimbursementAmount);

puts("是否繼續計算Y/N");

lcv_temp = getchar();
switch(toupper(lcv_temp))
{
case 'Y' : free(cur);
main();
break;
case 'N' : free(cur);
exit(0);
default : puts("輸入錯誤");
free(cur);
main();
break;
}

system("pause");

}

熱點內容
scratch少兒編程課程 發布:2025-04-16 17:11:44 瀏覽:626
榮耀x10從哪裡設置密碼 發布:2025-04-16 17:11:43 瀏覽:356
java從入門到精通視頻 發布:2025-04-16 17:11:43 瀏覽:71
php微信介面教程 發布:2025-04-16 17:07:30 瀏覽:296
android實現陰影 發布:2025-04-16 16:50:08 瀏覽:787
粉筆直播課緩存 發布:2025-04-16 16:31:21 瀏覽:337
機頂盒都有什麼配置 發布:2025-04-16 16:24:37 瀏覽:202
編寫手游反編譯都需要學習什麼 發布:2025-04-16 16:19:36 瀏覽:798
proteus編譯文件位置 發布:2025-04-16 16:18:44 瀏覽:355
土壓縮的本質 發布:2025-04-16 16:13:21 瀏覽:582