20191208-while +if
-
#include "stdafx.h"
-
#include "iostream"
-
#include "string"
-
using namespace std;
-
int main()
-
{ int line=0;
-
char ch;
-
while (cin.get(ch))
-
{
-
if(ch=='Q'){break;}
-
if(ch!='\n'){continue;}
-
}
-
}
程序思路:第11号可有可无。
下一组代码:
-
#include "stdafx.h"
-
#include "iostream"
-
#include "string"
-
using namespace std;
-
inline double square(double x){return x*x;}
-
int main()
-
{
-
double a,b;
-
double c=13.0;
-
a=square(5.0);
-
b=square(4.5+7.5);
-
cout<<"a="<<a<<endl;
-
cout<<"b="<<b<<endl;
-
cout<<square(c++)<<endl;
-
cout<<"c="<<c<<endl;
-
-
}
运行结果: