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

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

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

Чему будет равняться значение переменной 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;}

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

Варианты ответа
9(Верный ответ)
1
компилятор выдаст ошибку компиляции
5
Похожие вопросы

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

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

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

#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"class NewClass{  int x;  int y;  public:  NewClass(int x0,int y0)  {    x=x0;    y=y0;  }  void DISPLAY(void)  {    cout<<x<<" "<<y;  }  NewClass operator+(NewClass obj)  {    NewClass tmp(0,0);    tmp.x=x+obj.x;    tmp.y=y+obj.y;    return tmp;  }};int main(){  NewClass obj1(1,3),obj2(5,8);  obj1=obj1+obj2;  obj1.DISPLAY();  getch();  return 0;}	

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

	int SUMM(int x, int y){    return (x+y);}int main(){  int z=0;  {    int x=1;    int y=3;  }  z=SUMM(x,y);  return 0;}	

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

  int main()  { int a = 0, x = 2;    for (int i = 0; i < 1; i++)      { a++;        if (i == 1) goto B;        x++;      }    if (a > x) goto C;    /* x = 5; */    C:  a -= x;    B:  a += x;    cout << a << " " << x;    return 0;  }  

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

    #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();      }    

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

    #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 = 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>int sum(int a, int b);int main(){int a = 2, b - 3, c, d;с = sum(a, b); cin >> d;cout << sum(c, d);return 0;}int sum(int а, int b){ return (а + b);}