当前位置: 首页 > news >正文

一个网站做几个关键词搭建大数据平台费用

一个网站做几个关键词,搭建大数据平台费用,闵行区,图片库网站建设报价11.函数原型有参数时需要填写对应参数进行调用 这里原先call_me函数没有填写参数导致报错 添加一个usize即可 // functions3.rs // Execute rustlings hint functions3 or use the hint watch subcommand for a hint.fn main() {call_me(10); }fn call_me(num: u32) {for i i…11.函数原型有参数时需要填写对应参数进行调用 这里原先call_me函数没有填写参数导致报错 添加一个usize即可 // functions3.rs // Execute rustlings hint functions3 or use the hint watch subcommand for a hint.fn main() {call_me(10); }fn call_me(num: u32) {for i in 0..num {println!(Ring! Call number {}, i 1);} }12.函数需要返回值 fn sale_price(price: i32) - i32前面括号内是传入参数类型,后面是返回值类型 // functions4.rs // Execute rustlings hint functions4 or use the hint watch subcommand for a hint.// This store is having a sale where if the price is an even number, you get // 10 Rustbucks off, but if its an odd number, its 3 Rustbucks off. // (Dont worry about the function bodies themselves, were only interested // in the signatures for now. If anything, this is a good way to peek ahead // to future exercises!)fn main() {let original_price 51;println!(Your sale price is {}, sale_price(original_price)); }fn sale_price(price: i32) - i32{if is_even(price) {price - 10} else {price - 3} }fn is_even(num: i32) - bool {num % 2 0 }13.函数隐式返回,不能使用逗号作为默认返回 这里square函数隐式返回num*num,如果加上分号会返回() // functions5.rs // Execute rustlings hint functions5 or use the hint watch subcommand for a hint.// I AM NOT DONEfn main() {let answer square(3);println!(The square of 3 is {}, answer); }fn square(num: i32) - i32 {num * num }14.使用if编写函数功能 这里使用if判断ab的情况 然后分情况讨论 // if1.rs // Execute rustlings hint if1 or use the hint watch subcommand for a hint.pub fn bigger(a: i32, b: i32) - i32 {// Complete this function to return the bigger number!// Do not use:// - another function call// - additional variablesif ab {a}else {b} }// Dont mind this for now :) #[cfg(test)] mod tests {use super::*;#[test]fn ten_is_bigger_than_eight() {assert_eq!(10, bigger(10, 8));}#[test]fn fortytwo_is_bigger_than_thirtytwo() {assert_eq!(42, bigger(32, 42));} }15.嵌套if返回条件 // if2.rs// Step 1: Make me compile! // Step 2: Get the bar_for_fuzz and default_to_baz tests passing! // Execute rustlings hint if2 or use the hint watch subcommand for a hint.pub fn foo_if_fizz(fizzish: str) - str {if fizzish fizz {foo} else {if fizzish fuzz{bar}else {baz}} }// No test changes needed! #[cfg(test)] mod tests {use super::*;#[test]fn foo_for_fizz() {assert_eq!(foo_if_fizz(fizz), foo)}#[test]fn bar_for_fuzz() {assert_eq!(foo_if_fizz(fuzz), bar)}#[test]fn default_to_baz() {assert_eq!(foo_if_fizz(literally anything), baz)} }其中assert_eq!(a,b)是在比较a,b两个数值是否相等,用于做单元测试 16.使用if进行简单应用场景功能实现 自己编写calculate_price_of_apples(price:i32)-i32即可 // quiz1.rs // This is a quiz for the following sections: // - Variables // - Functions // - If// Mary is buying apples. The price of an apple is calculated as follows: // - An apple costs 2 rustbucks. // - If Mary buys more than 40 apples, each apple only costs 1 rustbuck! // Write a function that calculates the price of an order of apples given // the quantity bought. No hints this time!// Put your function here! fn calculate_price_of_apples(price:i32)-i32 {if (price40){return price*2;}return price;}// Dont modify this function! #[test] fn verify_test() {let price1 calculate_price_of_apples(35);let price2 calculate_price_of_apples(40);let price3 calculate_price_of_apples(41);let price4 calculate_price_of_apples(65);assert_eq!(70, price1);assert_eq!(80, price2);assert_eq!(41, price3);assert_eq!(65, price4); }17.利用boolean类型变量做判断 // primitive_types1.rs // Fill in the rest of the line that has code missing! // No hints, theres no tricks, just get used to typing these :)fn main() {// Booleans (bool)let is_morning true;if is_morning {println!(Good morning!);}let is_evening false;// let // Finish the rest of this line like the example! Or make it be false!if is_evening {println!(Good evening!);} }18.判断字符类型 我们在这里只需要填一个字符即可,即使是emjoy // primitive_types2.rs // Fill in the rest of the line that has code missing! // No hints, theres no tricks, just get used to typing these :)fn main() {// Characters (char)// Note the _single_ quotes, these are different from the double quotes// youve been seeing around.let my_first_initial C;if my_first_initial.is_alphabetic() {println!(Alphabetical!);} else if my_first_initial.is_numeric() {println!(Numerical!);} else {println!(Neither alphabetic nor numeric!);}let your_characteru;// Finish this line like the example! Whats your favorite character?// Try a letter, try a number, try a special character, try a character// from a different language than your own, try an emoji!if your_character.is_alphabetic() {println!(Alphabetical!);} else if your_character.is_numeric() {println!(Numerical!);} else {println!(Neither alphabetic nor numeric!);} }19.获取字符串长度 // primitive_types3.rs // Create an array with at least 100 elements in it where the ??? is. // Execute rustlings hint primitive_types3 or use the hint watch subcommand for a hint.fn main() {let a 99999999999999999999999999999999;if a.len() 100 {println!(Wow, thats a big array!);} else {println!(Meh, I eat arrays like that for breakfast.);} }20.字符串切片 使用引用变量 [leftIndex..rightIndex)区间内切片 // primitive_types4.rs // Get a slice out of Array a where the ??? is so that the test passes. // Execute rustlings hint primitive_types4 or use the hint watch subcommand for a hint.#[test] fn slice_out_of_array() {let a [1, 2, 3, 4, 5];let nice_slice a[1..4];assert_eq!([2, 3, 4], nice_slice) }
http://www.eeditor.cn/news/119510/

相关文章:

  • 官方网站建立api网站制作
  • 怎么开发网站平台安阳网站建设公司
  • 免费网站用官微建站wordpress建外贸
  • 制度建设对网站管理的重要性大一网页设计实训总结
  • 广州市建设工程交易服务中心网站贵州 跨境电商网站建设
  • 重庆网站建设重庆零臻科技行网站推广的基本方法为
  • wordpress能做app吗网站排名优化培训电话
  • 龙岩做网站推广网站建设哪家好
  • 国贸商城 网站建设贵州省建设学校网站
  • 企业网站的建立标准网站开发专业就业前景
  • 搭建网站公司哪家好网站如何做支付宝接口
  • 为什么登录不上建设银行网站萍乡网页设计
  • 国外有哪些做服装的网站有哪些方面wordpress的用户名与密码
  • 多语言外贸网站源码北京市住房城乡建设行业从业人员考务网站
  • 怎么联系做网站公司网站具有购买功能需要怎么做
  • 河北省建设厅网站备案网站建设资讯版块如何做用户运营
  • 做背景视频哪个网站好找题做的网站
  • 做风筝网站35岁学设计晚不晚
  • 网站建设及优化重要性企业信息查询免费
  • 白酒网站定制开发wordpress页面id
  • 深圳网站建设的公司招聘晋江外贸网站开发
  • 网站做推广页需要什么软件有哪些wordpress旅游插件
  • 建设银行租房网站湖北做教育培训网站需要资质么
  • 中学院新校区建设专题网站pinterest的优点
  • 时尚类网站设计公司学生个人网页制作素材
  • 网站的网站地图怎么做郑州建设信息网打不开
  • 四川省建设监理管理协会网站沧州建设网站公司
  • 网站建设方案书设计图在线修图编辑器
  • 网站开发软件科技公司wordpress+短视频主题
  • 万盛网站建设湖北省南漳县城乡建设局网站