c语言常用基础英文,C语言基础试题(国外英文资料).doc

C语言基础试题(国外英文资料)

C语言基础试题

Display a short sentence "Programming in C is fun!" on the screen.

Input integer a and b, calculate and output a, b, and the difference.

Ex. :

So that's the parenthesis.

The input

2-8 -

The output

Negative 6, 10 (and 6, 10)

Enter 1 real x, calculate and output the square root (keep 1 bit of decimal).

Ex. :

The input

17

The output

4.1

Enter Fahrenheit temperature f, calculate and output the corresponding Celsius c (keep 2 decimal places). C is equal to 5/9 times f minus 32.

Example: the parenthesis is the explanation

The input

17.2 (Fahrenheit)

The output

8.22

Enter two integers, time1 and time2, to indicate the departure time and arrival time of the train, and to calculate and output the journey time.

The effective time range is 0000 to 2359, and you do not need to consider the departure time later than the arrival time.

Example: the parenthesis is the explanation

The input

712 1411 (the departure time is 7:12, the arrival time is 14:11)

The output

The train journey time is 6 HRS 59 mins.

Enter a four-digit number to encrypt the output. Method is to add 9 figures on the number of each, and divide it by more than 10 take, as the number of new on the bit, the last will be first and the third the Numbers on the swap, the Numbers in the second and fourth swaps, composed the encrypted new number.

Example: the parenthesis is the explanation

The input

1257

The output

The encrypted number is 4601 (The number of each digit plus 9 divided by 10 is 0146, which is 4601 after The exchange)

Type in a capital English letter and output the appropriate lowercase letter.

Ex. :

The input

G

The output

g

Enter a student's math score if it is below 60 and output "Fail", otherwise the output "Pass".

Ex. :

The input

60

The output

Pass

The input

59

The output

Fail

Enter four integers and output the minimum.

Example: the parenthesis is the explanation

The input

12 June 1, 90

The output

Min is 1 (the minimum value in 12, 6, 1, 90 is 1)

Tip: do not output any other non-relevant symbols

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
抱歉,我是一名语言模型,无法提供文档或程序的下载和分享。但是,我可以为您提供修改密码程序的基本思路和示例代码。 修改密码程序的基本思路如下: 1. 提示用户输入旧密码。 2. 验证旧密码是否正确。 3. 如果旧密码正确,则提示用户输入新密码。 4. 输入新密码后,再次要求用户确认新密码。 5. 如果两次输入的新密码相同,则将新密码存储为用户的密码,并提示修改成功。 6. 如果两次输入的新密码不同,则提示用户两次输入的密码不一致,并要求重新输入新密码。 以下是修改密码程序的示例代码: ``` #include <stdio.h> #include <string.h> int main() { char password[20]; // 存储密码的数组 char old_pwd[20]; // 存储旧密码的数组 char new_pwd[20]; // 存储新密码的数组 char confirm_pwd[20];// 存储确认密码的数组 // 初始化密码为 123456 strcpy(password, "123456"); // 提示用户输入旧密码 printf("请输入旧密码:"); scanf("%s", old_pwd); // 验证旧密码是否正确 if(strcmp(old_pwd, password) != 0) { printf("旧密码输入错误!\n"); return 0; } // 提示用户输入新密码 printf("请输入新密码:"); scanf("%s", new_pwd); // 要求用户确认新密码 printf("请再次输入新密码:"); scanf("%s", confirm_pwd); // 检查两次输入的新密码是否一致 if(strcmp(new_pwd, confirm_pwd) != 0) { printf("两次输入的新密码不一致!\n"); return 0; } // 更新密码 strcpy(password, new_pwd); printf("密码修改成功!\n"); return 0; } ``` 注意:上述示例代码只是一个简单的演示,实际应用中需要考虑更多的安全性和可靠性问题。例如,可以对密码进行加密存储,防止被恶意破解等。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值