单项选择题
有以下程序: #include <iostream> using namespace std; int main() { int x; for(int i=1;i<=100;i++) { x=i; if (++x%2==0) if (++x%3==0) if (++x%7==0) cout<<x<<","; } cout<<end1; return 0; } 执行后输出结果是( )。
A.39,81
B.42,84
C.26,68
D.28,70
点击查看答案&解析
<上一题
目录
下一题>
热门
试题
单项选择题
有以下程序: #include <iostream> #include <string> using namespace std; class base { private: char baseName[10]; public: base ( ) { strcpy (baseName, Base ); } virtual char *myName() { return baseName; } char *className() { return baseName; } }; class Derived : public base { private: char derivedName[10]; public: Derived() { strcpy(derivedName, Derived ); } char *myName() { return derivedName; } char *className() { return derivedName; } }; void showPtr(base &p) { cout<<p.myName()<< <<p.className() ; } int main () { base bb; Derived dd; showPtr(dd) ; return 0; }
A.DerivedBase
B.BaseBase
C.DerivedDerived
D.BaseDerived
点击查看答案&解析
单项选择题
有以下程序: #include <iostream> #include <fstream> using namespace std; int main ( ) { ofstream ofile; char ch; ofile.open ( abc.txt ); cin>>ch; while (ch!=’#’ ) { cin>>ch; ofile.put(ch); } ofile.close(); return 0; } 当从键盘终端连续输入的字符为a、b、c和#时,文件abc.txt中的内容为( )。
A.程序编译时出错
B.abc#
C.abc
D.#
点击查看答案&解析
相关试题
以下程序的执行结果为( )。 #include...