Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
3403 吴奕希 书的价格 C++ Compile Error 0 MS 0 KB 485 2024-06-03 19:52:44

Tests(0/0):


Code:

# include<iostream> # include<algorithm> using namespace std; struct Book{ string name; double price; }books[10]; bool cmp(Book b1, Book b2){ return b1.price>b2.price; } int main(){ int n; cin>>n; for(int i = 0; i < n; i++){ getline(cin, books[i].name); cin>>books[i].price; } sort(books, books+n, cmp) printf("%.2lf,%c/n%.2lf,%c", books[0].price, books[0].name, books[1].price, books[1].name) return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:19:5: error: expected ';' before 'printf'
     printf("%.2lf,%c/n%.2lf,%c", books[0].price, books[0].name, books[1].price, books[1].name)
     ^