fork(1) download
  1. #include <iostream>
  2. #include <string>
  3. #include <locale>
  4.  
  5. using namespace std;
  6.  
  7. /* ********************************
  8.   * Лабораторная работа № 1 *
  9.   * Выполнил(а): ст. гр. ЗИ-123 *
  10.   * Иванов Андрей Петрович *
  11.   ******************************** */
  12.  
  13. int main() {
  14.  
  15. setlocale(LC_ALL,"Russian");
  16. string name, family, father, group="123";
  17. cout <<"Фамилия"<<endl;
  18. cin >> family;
  19. cout <<"Имя"<<endl;
  20. cin >> name;
  21. cout <<"Отчество"<<endl;
  22. cin >> father;
  23.  
  24. string text[4];
  25. text[1]="Лабораторная работа № 1";
  26. text[2]="Выполнил(а): ст. гр. ЗИ-";
  27. text[3]=family+" "+name+" "+father;
  28.  
  29. int maxLen
  30. if (text[1].size>text[2].size) {
  31. maxLen=text[1].size;
  32. } else {
  33. maxLen=text[2].size;
  34. }
  35.  
  36. int starNum=10;
  37. string stars;
  38. for (int i=0;i<starNum;++i){
  39. stars+="*";
  40. }
  41.  
  42. text[0]=stars;
  43. text[4]=stars;
  44.  
  45. for (i;i<=4;++i){
  46. cout <<text[i]<<endl;
  47. }
  48.  
  49. return 0;
  50. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:30:2: error: expected initializer before ‘if’
  if (text[1].size>text[2].size) {
  ^~
prog.cpp:32:4: error: ‘else’ without a previous ‘if’
  } else {
    ^~~~
prog.cpp:33:3: error: ‘maxLen’ was not declared in this scope
   maxLen=text[2].size;
   ^~~~~~
prog.cpp:45:7: error: ‘i’ was not declared in this scope
  for (i;i<=4;++i){
       ^
stdout
Standard output is empty