如图,在梯形中阴影部分面积是150平方厘米,求梯形面积。
#include <iostream> #include <cstdio> #include <cstdlib> using namespace std; int main(){ float s,h,up,down; up = 15; down = 25; h = 2* 15 / up; s = (up+down)*h/2; printf("s=%.2f\n",s); system("pause"); return 0; }
已知一位小朋友的电影票价是10元,计算x为小朋友的总票价是多少?
#include <iostream> #include <cstdio> using namespace std; int main(){ int x,y; cin >> x; y = 10 * x; cout << x << " " << y << endl; return 0; }
有一个牧场,牧场上的牧草每天都在匀速生长,这片牧场可供15头牛吃20天,或可供20头牛吃10天,那么,这片牧场每天新生的草量可供几头牛吃1天?
#include <iostream> #include <cstdio> using namespace std; int main(){ int s1,s2,s3; s1 = 15 * 20; s2 = 20 * 10; s3 = (s1-s2)/(20-10); cout << "s=" << s3 << endl; return 0; }
设:
则:
设
则
#
###
#####
给定一个字符,用它构造一个底边长5个字符的等腰字符三角形。
#include <iostream> #include <cstdio> using namespace std; int main(){ char a; cin >> a; cout << " " << a << endl; cout << " " << a << a << a << endl; cout << a << a << a << a << a << endl; return 0; }
#include <iostream> int main() { std::cout << "Hello, World!" << std::endl; return 0; }
#include <iostream> using namespace std; int main(){ int a,b,c; cin >> a >> b >> c; cout << b << endl; return 0; }
#include <iostream> using namespace std; int main() { int a,b,c; cin >> a >> b >> c; printf("%8d %8d %8d",a,b,c); return 0; }
#include <iostream> using namespace std; int main(){ char c; cin >> c; cout << " " << c << endl; cout << " " << c << c << c << endl; cout << c << c << c << c << c << endl; return 0; }
#include <iostream> using namespace std; int main(){ double x,a,y,b; cin >> x >> a >> y >> b; printf("%.2f",(b*y-a*x)/(b-a)); return 0; }