写个博客应该不容易被看到吧
c++
//根据半径计算圆的周长和面积
#include <iostream.h>
const float PI=3.1416; //声明常量(只读变量)PI为3.1416
float fCir_L(float); //声明自定义函数fCir_L()的原型
float fCir_S(float); //声明自定义函数fCir_S()的原型
//以下是main()函数
main()
{
float r,l,s; //声明3个变量
cout<<"r="; //显示字符串
cin>>r; //键盘输入
l=fCir_L(r); //计算圆的周长,赋值给变量l
s=fCir_S(r); //计算圆的面积,赋值给变量s
cout<<"l="<<l; //显示计算结果
cout<<"\ns="<<s;
}
java
public static void main(String[] args){
System.out.print("Hello");
}
c
#include<stdio.h>
main(){
int i;
for ( i = 0; i <= 5000; i++){
if ((i%4==0 && i%100!=0) || i%40==0)
printf("%d\n",i);
}
return 0;
}
Python2
class Solution: def solve(self , str1 ): # write code here return(str1[::-1])Pypy2
total = 0
for i in range(1, 10000):
for j in range(1, 10000):
total += i + j
print(f"The result is {total}")
Pypy3
import time
start_time = time.time()
total = 0
for i in range(1, 10000):
for j in range(1, 10000):
total += i + j
print(f"The result is {total}")
end_time = time.time()
print(f"It took {end_time-start_time:.2f} seconds to compute")
JavaScript
function solve( str ) {
return str.split('').reverse().join("");
}
module.exports = {
solve : solve
};
PHP
<?php
function solve( $str )
{
$intLen = strlen($str);
$strOut = '';
for($i = $intLen - 1; $i>=0;$i--){
$strOut .= $str[$i];
}
return $strOut;
}
c#
using System;
using System.Collections.Generic;
class Solution {
public string solve (string str) {
// write code here
int n = str.Length;
char[] charstr = str.ToCharArray();
string res = "";
for(int i = n-1; i>=0; --i) {
res += charstr[i].ToString();
}
return res;
}
}
R
//while loop
a <- 2
while(a<5){
print('hello')
a = a + 1
}
//for loop
v <- c(1,2,5,7,9,6)
for(i in v){
print(i)
}
go
package main
func solve( str string ) string {
// write code here
var tmp []byte
bytes:=[]byte(str)
for i:=len(bytes)-1;i>=0;i--{
tmp=append(tmp, bytes[i])
}
return string(tmp)
}
Ruby
struct Solution{
}
impl Solution {
fn new() -> Self {
Solution{}
}
pub fn solve(&self, str: String) -> String {
// write code here
str.chars().rev().collect::<String>()
}
}
bash
STR="Hello World" echo $STRshell
funWithReturn(){
echo "这个函数会对输入的两个数字进行相加运算..."
echo "输入第一个数字: "
read aNum
echo "输入第二个数字: "
read anotherNum
echo "两个数字分别为 $aNum 和 $anotherNum !"
return $(($aNum+$anotherNum))
}
funWithReturn
echo "输入的两个数字之和为 $? !"
CSS
#kw::-ms-clear {
display: none
}
#kw::-webkit-input-placeholder,#kw::-moz-input-placeholder,#kw:-moz-input-placeholder,#kw:-ms-input-placeholder {
color: #ccc
}
HTML
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> ... </html>XML
<?xml version="1.0" encoding="UTF-8" ?> <soft> <a> <a1>中国</a1> <a2></a2> </a> <b> <b1></b1> <b2></b2> </b> </soft>VB
if i=10 then msgbox "Hello" else msgbox "Goodbye" end IfPerl
#!/usr/bin/perl $age = 25; # 整型 $name = "runoob"; # 字符串 $salary = 1445.50; # 浮点数 print "Age = $age\n"; print "Name = $name\n"; print "Salary = $salary\n";Swift
public class Solution {
func solve ( _ str: String) -> String {
// write code here
var container = [Character]()
for value in str {
container.append(value)
}
return String(container.reversed())
}
}
ObjC
@interface ClassName : ItsSuperclass
{
// Instance variable declarations.
}
// Method and property declarations.
@end
Pascal
type
Letters = set of Char;
var
Name: string;
begin
{ long comment and long statement, going on in the
following line and indented two spaces }
MessageDlg ('This is a message',
mtInformation, [mbOk], 0);
matlab
function [c,d] = add(a,b) for i =1:1:10 c = a + i; d = b * i; end endScala
object Solution {
def solve(str: String): String = {
// write code here
if(str.length()<=1000){
str.reverse
}else{
str
}
}
}
Kotlin
object Solution {
fun solve(str: String): String {
val array = str.toCharArray()
val len = array.size
for(i in 0 until len/2){
val temp : Char = array[i]
val c1 : Char = array[len - i - 1]
array[i] = c1
array[len - i - 1] = temp
}
return String(array)
}
}
Groovy
def getLatestSuccessSummary(projectId, taskId){
def jsonSlurper = new JsonSlurper()
httpRequest outputFile: 'summary.txt',
responseHandle: 'NONE',
customHeaders: [[name: 'Accept', value: "application/json"],[name: 'direwolf', value: "pipeline"]],
url: "https://xxx.com.cn/api/project/${projectId}/task/${taskId}/latest-success-summary",
httpMode: "GET"
def summary_json = readFile "summary.txt"
summary_json = jsonSlurper.parseText(summary_json)
summary = "${summary_json["data"]["statistics"]["issue"]["groupByPriority"]}"
return summary
}
TypeScript
export function solve(str: string): string {
// write code here
return str.length<1000&&str.split("").reverse().join("")
}
SQL
select * from test_Tablemysql
SELECT device_id,gender,age,university FROM user_profile where age!=0oracle
insert into java values(1,'张三','男',to_date('1997-02-22','yyyy-mm-dd'),'济南');
Sqlite
@interface IWViewController ()
{
// 成员变量默认=NULL
sqlite3 *_db; // db代表着整个数据库,db是数据库实例
}
- (IBAction)insert;
- (IBAction)update;
- (IBAction)delete;
- (IBAction)query;
@end
Scheme
(define x 123)<br style="word-wrap:break-word" />(+ 1 2)<br style="word-wrap:break-word" />(* 4 5 6)<br style="word-wrap:break-word" />(display "hello world")<br style="word-wrap:break-word" />TCL
set x 10 set y 100 + x其他
// 还有其他语言的代码还有原来的功能看看对不对
加粗
斜体
下划线
标题1
标题2
标题3
标题4
正文
引用
😂🤣
" src="https://uploadfiles.nowcoder.com/files/20210413/63_1618294985952/f.gif" />
" src="https://uploadfiles.nowcoder.com/files/20210413/63_1618294960071/e.gif" />
| 1 | 2 |
| 3 |
4
|
34

