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

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

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

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

  int SM(const int A[], int N)  { int S = A[0];    for (int i = 1; i < N; i++) S += A[i];    return S;  }    int main()  {   #define Bmax 4    int B[] = {4, 3, 2, 1};    cout << SM(B, Bmax) << endl;  }  

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

Варианты ответа
6
10(Верный ответ)
7
ошибка выполнения
Похожие вопросы

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

  int SM(const int A[], int N)  { int S = A[0];    for (int i = 1; i < N; i++) S += A[i];    return S;  }    int main()  {   #define Bmax 3    int B[5] = {1, 2, 3};    cout << SM(B, Bmax) << endl;  }  

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

  int SM(const int A[], int N)  { int S = A[0];    for (int i = 1; i < N; i++) S += A[i];    return S;  }    int main()  {   #define Bmax 6    int B[6] = {1, 2, 3, 4, 5, 6};    cout << SM(B + 3, Bmax - 3) << endl;    return 1;  }  

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

int main(){  int i = 5;  int* pi = &i;  void * v = pi;  pi = v;  cout << *pi;  return 0;}  

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

  #include <iostream>  int f1(int x, int y)    {  return x + y; }  int f2(int x, int y)    {  return x * x + y * y; }  int (*pf1)(int, int);  int (*pf2)(int, int);  main()  { pf1 = &f1;    pf2 = &f2;    int x = 2, y = 3;    cout << (*pf1)(x, y) << ' ' << (*pf2)(x, y) << endl;  }  

Какой будет результат следующей программы?

class t{     public: t() { s = 4; }    ~t() {};    int s;    int f(int a)    {        s--;        return s * a;     }    class t2    { public : int i; }; };int main(){    t obj_t;    t::t2 obj_t2;    obj_t2.i = 10;    cout << (obj_t.f(2) + obj_t2.i) << endl;}

Какой будет результат следующей программы?

  class t  { public: t() { s = 2; }            ~t() {};            int s;            int f(int a)             { s++;               return s * a;             }            class t2            { public : int i; };  };	main()	{ t obj_t;    t::t2 obj_t2;    obj_t2.i = 5;		cout <<	(obj_t.f(2) + obj_t2.i) << endl;	}	

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

  main()  { int x = 0;     for (int i = 0; i < 5; i++)       for (int j = 0; j < 3; j++)          { x++;           if (j) continue;             else break;         }    cout << x;  }  

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

  #include <iostream>  double s2(double x)    { return x*x; }  double s3(double x)    { return x*s2(x); }  double s4(double x)    { return s2(x)*s2(x); }  int main()  { typedef double (*PTF)(double);     PTF pf[3] = {&s2, &s3, &s4};     double x = 2;     for(int i = 0; i < 3; i++)         cout << (*pf[i])(x) << endl;     return 0;   }  

Какой будет результат следующей программы?

class t{             public: t(int i, int j);            ~t() {};            int s, m;            class t2            { public : int i; };};t::t(int i, int j){             s = i; m = j; }int main(){             t obj_t(5, 10);            t::t2 obj_t2;            obj_t2.i = 10;            cout <<	(obj_t.s + obj_t.m + obj_t2.i) << endl;            return 0;}

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

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