База ответов ИНТУИТ

Язык программирования C++ для профессионалов

<<- Назад к вопросам

Что производит эта программа?

#include <fstream>#include <vector>#include <stack>using namespace std:int main(){ifstream in ("inpnum");stack <int. vector<int> > s;int x;while ( in >> x. !in.eof()) s.push(x);while (!s.empty()){X = s.top(); cout << x << " ";s.pop();return 0;}}	

(Отметьте один правильный вариант ответа.)

Варианты ответа
расширение пространства имен
вывод чисел из файла(Верный ответ)
расширение области видимости
создание массива указателей
Похожие вопросы

Для чего предназначена следующая программа и верна ли она:

#include <iostream>#include <fstream>#include <vector>#include <stack>using namespace std;int main(){    ifstream in ("inpnum");    stack <int, vector<int> > s;    int x;    while (in >> x, !in.eof()) s.push(x);    while (! s.empty())    {        x = s.top(); cout << x << " ";        s.pop();    }}

Какой результат будет у следующего выражения?

    #include <iostream.h>    #include <fstream.h>    int main ( )    {    int i = 5, j = 10;  double a = 25;   char s[40];    strcpy(s, "Test");    ofstream outfile("c:\\tst.txt");    if (!outfile)      { cout << "Ошибка создания файла";        return 1;  }    outfile << i << ' ' << j << ' ' << a << ' ' << s << endl;    outfile.close();      }    

Какой результат будет у следующего выражения?

    #include <iostream.h>    #include <fstream.h>    int main( )    {    int i = 1, j = 11;  double a = 2;   char s[40];    strcpy(s, "file");    ofstream outfile("c:\\tst.txt");    if (!outfile)      { cout << "Ошибка создания файла";        return 1;  }    outfile << i << ' ' << j << ' ' << a << ' ' << s << endl;    outfile.close();      }    

Какая строка данного кода производит возврат элемента по указателю?

#define SIZE 100int Stack[SIZE]; int SP; void lnit(){ SP = - 1 ; } void Push(int val) { Stack[ ++SP]=val; }int Рор() { if (SP < О ) return(O); return ( Stack[SP--]); }	

Какой результат будет у следующего выражения?

    #include <iostream.h>    #include <fstream.h>    int main(      {    int i = 1, j = 25;  double a = 25e6;   char s[40];    strcpy(s, "Test");    ofstream outfile("c:\\test.txt");    if (!outfile)      { cout << "Ошибка создания файла";        return 1;  }    outfile << i << ' ' << j << ' ' << a << ' ' << s << endl;    outfile.close();      }    

Правильно ли написан нижеприведенный программный код?

#include "iostream.h"#include "conio.h"int main(){  int x=17,y=46;  cout<<x<<"+"<<y<<"="<<x+y;  getch();  return 0;}	

Верен ли нижеприведенный код? Каков результат его работы?

#include <iostream>#include "conio.h"int main(){   enum {t, x, y, z ,w};  cout<<t+x+y+z+w;  getch();  return 0;}

Что будет выведено на экран в результате выполнения приведенной ниже программы:

	#include "iostream.h"#include "conio.h"const int a=144;int main(){  a=12;  cout<<a;  getch();  return 0;}	

Чему будет равняться значение переменной x после выполнения следующего кода:

#include "iostream.h"#include "conio.h"int main(){  int x=1;  M2:;  for(int i=1;i<5;i++,x++);  if(x>5)    goto M1;  else    goto M2;  M1: cout<<x;  getch();  return 0;}

Что будет напечатано в результате работы следующей программы?

  #include <iostream>  #include <math>  double s2(double x)    {  return sqrt(x); }  double s3(double x)    {  return sqrt(s2(x)); }  double (*pf1)(double);  double (*pf2)(double);  main()  { pf1 = &s2;    pf2 = &s3;    cout << (*pf1)(25) << ' ' << (*pf2)(16) << endl;  }