c++ 练习源码,均测试通过 终端基本输入输出求平均数

常用各类软硬件使用技巧、疑难、最新资讯等相关交流
Anya78On
帖子: 22
注册时间: 2024-10-24 20:54

Great reading too 78 !

帖子 Anya78On »

Hello everyone!
I came across a 78 awesome site that I think you should dive into.
This resource is packed with a lot of useful information that you might find helpful.
It has everything you could possibly need, so be sure to give it a visit!
https://onpointy.com/from-grassroots-to-stardom-the-journey-of-emerging-talents-in-football/
Anya78On
帖子: 22
注册时间: 2024-10-24 20:54

Great reading too 78 !

帖子 Anya78On »

Hello .!
I came across a 78 useful site that I think you should visit.
This site is packed with a lot of useful information that you might find helpful.
It has everything you could possibly need, so be sure to give it a visit!
https://sometimes-interesting.com/traveling-to-the-worlds-top-gaming-spots/
rungod
帖子: 43
注册时间: 2010-06-19 3:51

Re: c++ 练习源码,均测试通过 CGI

帖子 rungod »

代码: 全选

#include <iostream>
#include <stdio.h>

using namespace std;

int main() {
 
   cout << "Content-type:text/html\n\n";
   cout << "<html>\n";
   cout << "<head>\n";
   cout << "<title>Hello World the first CGI</title>\n";
   cout << "</head>\n";
   cout << "<body>\n";
   cout << "<h2>Hello World! the first CGI program</h2>\n";
   cout << "</body>\n";
   

    return 0;
}
代码很简单,却踏了新手两个经典坑:
1.在windows客户端编译好的二进制不能直接上传到linux服务端;
2.cout << "Content-type:text/html\n\n";这句一定是两个“\n”,否则报500错误,这个问题很隐蔽。
心海质水
rungod
帖子: 43
注册时间: 2010-06-19 3:51

c++ 练习源码,均测试通过 终端基本输入输出求平均数

帖子 rungod »

代码: 全选

#include <iostream>
using std::cout;
using std::cin;
using std::endl;

int main(){
	int total;
	int gradecouter;
	int grade;
	int average;
	total=0;
	gradecouter=1;
	while (gradecouter<=10){
		cout<<"input number please:";
		cin>>grade;
		total=total+grade;
		gradecouter=gradecouter+1;
		
	}
	average=total/10;
	cout<<"Class average is"<<average<<endl;
	return 0;
}
上次由 rungod 在 2024-10-29 15:27,总共编辑 1 次。
心海质水
回复