Ошибка c2059 синтаксическая ошибка using namespace

description title ms.date f1_keywords helpviewer_keywords ms.assetid

Learn more about: Compiler Error C2059

Compiler Error C2059

03/26/2019

C2059

C2059

2be4eb39-3f37-4b32-8e8d-75835e07c78a

Compiler Error C2059

syntax error : ‘token’

The token caused a syntax error.

The following example generates an error message for the line that declares j.

// C2059e.cpp
// compile with: /c
// C2143 expected
// Error caused by the incorrect use of '*'.
   int j*; // C2059

To determine the cause of the error, examine not only the line that’s listed in the error message, but also the lines above it. If examining the lines yields no clue about the problem, try commenting out the line that’s listed in the error message and perhaps several lines above it.

If the error message occurs on a symbol that immediately follows a typedef variable, make sure that the variable is defined in the source code.

C2059 is raised when a preprocessor symbol name is re-used as an identifier. In the following example, the compiler sees DIGITS.ONE as the number 1, which is not valid as an enum element name:

#define ONE 1

enum class DIGITS {
    ZERO,
    ONE // error C2059
};

You may get C2059 if a symbol evaluates to nothing, as can occur when /Dsymbol= is used to compile.

// C2059a.cpp
// compile with: /DTEST=
#include <stdio.h>

int main() {
   #ifdef TEST
      printf_s("nTEST defined %d", TEST);   // C2059
   #else
      printf_s("nTEST not defined");
   #endif
}

Another case in which C2059 can occur is when you compile an application that specifies a structure in the default arguments for a function. The default value for an argument must be an expression. An initializer list—for example, one that used to initialize a structure—is not an expression. To resolve this problem, define a constructor to perform the required initialization.

The following example generates C2059:

// C2059b.cpp
// compile with: /c
struct ag_type {
   int a;
   float b;
   // Uncomment the following line to resolve.
   // ag_type(int aa, float bb) : a(aa), b(bb) {}
};

void func(ag_type arg = {5, 7.0});   // C2059
void func(ag_type arg = ag_type(5, 7.0));   // OK

C2059 can occur for an ill-formed cast.

The following sample generates C2059:

// C2059c.cpp
// compile with: /clr
using namespace System;
ref class From {};
ref class To : public From {};

int main() {
   From^ refbase = gcnew To();
   To^ refTo = safe_cast<To^>(From^);   // C2059
   To^ refTo2 = safe_cast<To^>(refbase);   // OK
}

C2059 can also occur if you attempt to create a namespace name that contains a period.

The following sample generates C2059:

// C2059d.cpp
// compile with: /c
namespace A.B {}   // C2059

// OK
namespace A  {
   namespace B {}
}

C2059 can occur when an operator that can qualify a name (::, ->, and .) must be followed by the keyword template, as shown in this example:

template <typename T> struct Allocator {
    template <typename U> struct Rebind {
        typedef Allocator<U> Other;
    };
};

template <typename X, typename AY> struct Container {
    typedef typename AY::Rebind<X>::Other AX; // error C2059
};

By default, C++ assumes that AY::Rebind isn’t a template; therefore, the following < is interpreted as a less-than sign. You must tell the compiler explicitly that Rebind is a template so that it can correctly parse the angle bracket. To correct this error, use the template keyword on the dependent type’s name, as shown here:

template <typename T> struct Allocator {
    template <typename U> struct Rebind {
        typedef Allocator<U> Other;
    };
};

template <typename X, typename AY> struct Container {
    typedef typename AY::template Rebind<X>::Other AX; // correct
};

You had quite a few transcription errors. In other words, unless the book is absolutely horrid, you introduced syntax errors on your own when typing the code in. I’ve cleaned it up for you and fixed the syntax errors. Don’t expect me to do it again:

#pragma once

namespace speedgame {
  using namespace System;
  using namespace System::ComponentModel;
  using namespace System::Collections;
  using namespace System::Windows::Forms;
  using namespace System::Data;
  using namespace System::Drawing;

  /// <summary>
  /// Summary for Form1
  ///
  /// WARNING: If you change the name of this class, you will need to change the
  ///          'Resource File Name' property for the managed resource compiler tool
  ///          associated with all .resx files this class depends on.  Otherwise,
  ///          the designers will not be able to interact properly with localized
  ///          resources associated with this form.
  /// </summary>
  public ref class Form1: public System::Windows::Forms::Form {
  public:
    Form1()
    {
      InitializeComponent();
    }

  protected:
    /// <summary>
    /// Clean up any resources being used.
    /// </summary>
    ~Form1()
    {
      if ( components )
        delete components;
    }

  private:
    System::Windows::Forms::ToolTip^  tipControl;
    System::Windows::Forms::Timer^  tmrControl;
    System::Windows::Forms::TextBox^  txtDisplay;
    System::Windows::Forms::TextBox^  txtEntry;
    System::Windows::Forms::Label^  lblInstructions;
    System::Windows::Forms::Label^  lblSourceText;
    System::Windows::Forms::Label^  lblEntryText;
    System::Windows::Forms::StatusStrip^  stsControl;
    System::Windows::Forms::ToolStripStatusLabel^  stsLabel;
    System::Windows::Forms::Button^  btnGo;
    System::Windows::Forms::Button^  btnDone;
    System::Windows::Forms::Button^  btnExit;

    System::ComponentModel::IContainer^  components;

    Int16 intWrong; //Tracks number of strikes
    Int16 intCount; //Tracks number of tries
    Int16 intTimer; //Tracks elapsed time

#pragma region Windows Form Designer generated code
    /// <summary>
    /// Required method for Designer support - do not modify
    /// the contents of this method with the code editor.
    /// </summary>
    void InitializeComponent(void)
    {
      this->components = (gcnew System::ComponentModel::Container());
      this->tipControl = (gcnew System::Windows::Forms::ToolTip(this->components));
      this->txtDisplay = (gcnew System::Windows::Forms::TextBox());
      this->txtEntry = (gcnew System::Windows::Forms::TextBox());
      this->btnGo = (gcnew System::Windows::Forms::Button());
      this->btnDone = (gcnew System::Windows::Forms::Button());
      this->btnExit = (gcnew System::Windows::Forms::Button());
      this->tmrControl = (gcnew System::Windows::Forms::Timer(this->components));
      this->lblInstructions = (gcnew System::Windows::Forms::Label());
      this->lblSourceText = (gcnew System::Windows::Forms::Label());
      this->lblEntryText = (gcnew System::Windows::Forms::Label());
      this->stsControl = (gcnew System::Windows::Forms::StatusStrip());
      this->stsLabel = (gcnew System::Windows::Forms::ToolStripStatusLabel());
      this->stsControl->SuspendLayout();
      this->SuspendLayout();
      // 
      // txtDisplay
      // 
      this->txtDisplay->Location = System::Drawing::Point(40, 55);
      this->txtDisplay->Name = L"txtDisplay";
      this->txtDisplay->ReadOnly = true;
      this->txtDisplay->Size = System::Drawing::Size(675, 20);
      this->txtDisplay->TabIndex = 0;
      this->tipControl->SetToolTip(this->txtDisplay, L"Displays source text string");
      // 
      // txtEntry
      // 
      this->txtEntry->Location = System::Drawing::Point(40, 121);
      this->txtEntry->Name = L"txtEntry";
      this->txtEntry->ReadOnly = true;
      this->txtEntry->Size = System::Drawing::Size(675, 20);
      this->txtEntry->TabIndex = 1;
      this->tipControl->SetToolTip(this->txtEntry, L"Type your text here");
      // 
      // btnGo
      // 
      this->btnGo->Location = System::Drawing::Point(43, 216);
      this->btnGo->Name = L"btnGo";
      this->btnGo->Size = System::Drawing::Size(75, 23);
      this->btnGo->TabIndex = 6;
      this->btnGo->Text = L"GO";
      this->tipControl->SetToolTip(this->btnGo, L"Display new text string");
      this->btnGo->UseVisualStyleBackColor = true;
      this->btnGo->Click += gcnew System::EventHandler(this, &Form1::btnGo_Click);
      // 
      // btnDone
      // 
      this->btnDone->Enabled = false;
      this->btnDone->Location = System::Drawing::Point(639, 216);
      this->btnDone->Name = L"btnDone";
      this->btnDone->Size = System::Drawing::Size(75, 23);
      this->btnDone->TabIndex = 7;
      this->btnDone->Text = L"Done";
      this->tipControl->SetToolTip(this->btnDone, L"Check typing");
      this->btnDone->UseVisualStyleBackColor = true;
      this->btnDone->Click += gcnew System::EventHandler(this, &Form1::btnDone_Click);
      // 
      // btnExit
      // 
      this->btnExit->Location = System::Drawing::Point(639, 9);
      this->btnExit->Name = L"btnExit";
      this->btnExit->Size = System::Drawing::Size(75, 23);
      this->btnExit->TabIndex = 8;
      this->btnExit->Text = L"Exit";
      this->tipControl->SetToolTip(this->btnExit, L"Exit game");
      this->btnExit->UseVisualStyleBackColor = true;
      // 
      // tmrControl
      // 
      this->tmrControl->Interval = 1000;
      this->tmrControl->Tick += gcnew System::EventHandler(this, &Form1::tmrControl_Tick);
      // 
      // lblInstructions
      // 
      this->lblInstructions->AutoSize = true;
      this->lblInstructions->Location = System::Drawing::Point(12, 9);
      this->lblInstructions->Name = L"lblInstructions";
      this->lblInstructions->Size = System::Drawing::Size(511, 13);
      this->lblInstructions->TabIndex = 2;
      this->lblInstructions->Text = L"Click Go to begin. You have 15 seconds to type the text displayed in the source t" 
        L"ext field exactly as shown.";
      // 
      // lblSourceText
      // 
      this->lblSourceText->AutoSize = true;
      this->lblSourceText->Location = System::Drawing::Point(40, 39);
      this->lblSourceText->Name = L"lblSourceText";
      this->lblSourceText->Size = System::Drawing::Size(68, 13);
      this->lblSourceText->TabIndex = 3;
      this->lblSourceText->Text = L"Source Text:";
      // 
      // lblEntryText
      // 
      this->lblEntryText->AutoSize = true;
      this->lblEntryText->Location = System::Drawing::Point(40, 105);
      this->lblEntryText->Name = L"lblEntryText";
      this->lblEntryText->Size = System::Drawing::Size(79, 13);
      this->lblEntryText->TabIndex = 4;
      this->lblEntryText->Text = L"Enter text here:";
      // 
      // stsControl
      // 
      this->stsControl->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(1) {this->stsLabel});
      this->stsControl->Location = System::Drawing::Point(0, 270);
      this->stsControl->Name = L"stsControl";
      this->stsControl->Size = System::Drawing::Size(773, 22);
      this->stsControl->TabIndex = 5;
      this->stsControl->Text = L"statusStrip1";
      // 
      // stsLabel
      // 
      this->stsLabel->Name = L"stsLabel";
      this->stsLabel->Size = System::Drawing::Size(118, 17);
      this->stsLabel->Text = L"toolStripStatusLabel1";
      // 
      // Form1
      // 
      this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
      this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
      this->ClientSize = System::Drawing::Size(773, 292);
      this->Controls->Add(this->btnExit);
      this->Controls->Add(this->btnDone);
      this->Controls->Add(this->btnGo);
      this->Controls->Add(this->stsControl);
      this->Controls->Add(this->lblEntryText);
      this->Controls->Add(this->lblSourceText);
      this->Controls->Add(this->lblInstructions);
      this->Controls->Add(this->txtEntry);
      this->Controls->Add(this->txtDisplay);
      this->FormBorderStyle = System::Windows::Forms::FormBorderStyle::FixedSingle;
      this->Name = L"Form1";
      this->StartPosition = System::Windows::Forms::FormStartPosition::CenterScreen;
      this->Text = L"The Speed Game";
      this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load);
      this->stsControl->ResumeLayout(false);
      this->stsControl->PerformLayout();
      this->ResumeLayout(false);
      this->PerformLayout();

    }
#pragma endregion

    System::Void Form1_Load ( System::Object^ sender, System::EventArgs^ e )
    {
      //set begginning data values
      intWrong = 0;
      intCount = 0;
      intTimer = 0;
    }

    System::Void btnGo_Click ( System::Object^ sender, System::EventArgs^ e )
    {
      //Display game sentences according to level
      if( intCount == 0 )
        txtDisplay->Text = "Once upon a time there where three little pigs.";
      if( intCount == 1 )
        txtDisplay->Text = "In days gone by times where hard but the people were strong.";
      if( intCount == 2 )
        txtDisplay->Text = "Once in awhile something speacial happens even to the worst of people.";
      if( intCount == 3 )
        txtDisplay->Text = "When injustice rears its ugly hea, it is the duty of all good.";
      if( intCount == 4 )
        txtDisplay->Text = "It has been said that in the end there can only be one. Let that one be mighty Molly!";

      btnDone->Enabled = true; //Activate done button
      btnGo->Enabled = false; //Disable Go button

      //Allow text to be entered
      txtEntry->ReadOnly = false;

      //Activate Timer
      tmrControl->Enabled = true;
      intTimer = 0;
      txtEntry->Focus();
    }

    System::Void btnDone_Click ( System::Object^ sender, System::EventArgs^ e )
    {
      //Clear out status bar text
      stsControl->Text = "";

      //Deactivate Timer so it doesn't keep going
      tmrControl->Enabled = false;

      //Make sure player entered something
      if ( String::IsNullOrEmpty ( txtEntry->Text ) ) {
        //Show error
        MessageBox::Show ( "Error: You must enter something!" );
        //reset game
        txtDisplay->Text = "";
        btnDone->Enabled = false;
        btnGo->Enabled = true;
        txtEntry->ReadOnly = true;
        intTimer = 0;
        btnGo->Focus();
        return;
      }

      if ( String::Compare ( txtEntry->Text, txtDisplay->Text ) == 0 ) {
        //handle Correct answer
        MessageBox::Show ( "Match! You typed the string in correctly!" );
        intCount += 1;
        intTimer = 0;
      }
      else {
        //handle incorrect answer
        MessageBox::Show ( String::Concat ( "Strike ",
          intWrong.ToString(), "! You made at least",
          " one typo." ) );
        intTimer = 0;
      }

      //get set up for the next level
      txtEntry->Text = "";
      txtDisplay->Text = "";
      btnDone->Enabled = false;
      btnGo->Enabled = true;
      txtEntry->ReadOnly = true;
      intTimer = 0;
      btnGo->Focus();

      //handle 3 strikes
      if ( intWrong == 3 ) {
        //inform play he/she is a begginer
        if ( intCount < 2 ) {
          MessageBox::Show ( "Game Over! Your "
            "typing skill level is Beginner. "
            "Please play again!" );
          intCount = 0;
          intWrong = 0;
          return;
        }

        //inform play he/she is intermediate
        if ( intCount < 4 ) {
          MessageBox::Show ( "Game Over! Your "
            "typing skill level is intermediate. "
            "Please play again!" );
          intCount = 0;
          intWrong = 0;
          return;
        }

        //inform play he/she is advanced
        if ( intCount < 5 ) {
          MessageBox::Show ( "Game Over! Your "
            "typing skill level is advanced. "
            "Please play again!" );
          intCount = 0;
          intWrong = 0;
          return;
        }
      }
    }

    System::Void btnExit_Click ( System::Object^ sender, System::EventArgs^	e )
    {
      this->Close();
    }

    System::Void tmrControl_Tick ( System::Object^ sender, System::EventArgs^ e )
    {
      //update timer value
      intTimer += 1;
      Int16 intTimeRemain = 15 - intTimer;
      stsLabel->Text = "Seconds remaining: ";
      stsLabel->Text = String::Concat( stsLabel, intTimeRemain.ToString() );

      //handle running out of time
      if ( intTimer == 15 ) {
        intWrong += 1;
        tmrControl->Enabled = false;
        stsLabel->Text = "";
        MessageBox::Show ( String::Concat ( "Strike ",
          intWrong.ToString(), " - Time is up! Please",
          " try again." ) );

        //reset game
        txtEntry->Text = "";
        txtDisplay->Text = "";
        btnDone->Enabled = false;
        btnGo->Enabled = true;
        txtEntry->ReadOnly = true;
        intTimer = 0;
        btnGo->Focus();

        //handle 3 strikes
        if ( intWrong == 3 ) {
          //inform play he/she is a begginer
          if ( intCount < 2 ) {
            MessageBox::Show ( "Game Over! Your "
              "typing skill level is Beginner. "
              "Please play again!" );
            intCount = 0;
            intWrong = 0;
            return;
          }

          //inform play he/she is intermediate
          if ( intCount < 4 ) {
            MessageBox::Show ( "Game Over! Your "
              "typing skill level is intermediate. "
              "Please play again!" );
            intCount = 0;
            intWrong = 0;
            return;
          }

          //inform play he/she is advanced
          if( intCount < 5 ) {
            MessageBox::Show ( "Game Over! Your "
              "typing skill level is advanced. "
              "Please play again!" );
            intCount = 0;
            intWrong = 0;
            return;
          }
        }

        //player is an expert!
        if ( intCount >= 5 ) {
          intCount = 0;
          intWrong = 0;
          MessageBox::Show ( "Game Complete! Your "
            "typing skill level is Expert! "
            "Please try again!" );
        }
      }
    }
  };
}

Here are a few C++ tips:

1) Classes always end with a semicolon.
2) public, private, and protected are groupings. You don’t have to specify an access modifier for every single member.
3) C++ is case sensitive. int16 is quite different from Int16.
4) Every opening { has to have a corresponding closing }.

Solved


When I try to compile this program i keep getting these errors:

(50) : error C2059: syntax error :
‘<=’

(50) : error C2143: syntax error
: missing ‘;’ before ‘{‘

(51) : error
C2059: syntax error : ‘>’

(51) : error
C2143: syntax error : missing ‘;’
before ‘{‘

(62) : error C2059: syntax
error : ‘else’

(62) : error C2143:
syntax error : missing ‘;’ before ‘{‘


#include <iostream>
#include <string>
#include <cassert>
using namespace std;

class income {
private:
    double incm;
    double subtract;
    double taxRate;
    double add;
    char status;
public:
    void setStatus ( char stats ) { status = stats; }
    void setIncm (double in ) { incm = in; }
    void setSubtract ( double sub ) { subtract = sub; }
    void setTaxRate ( double rate ) { taxRate = rate; }
    void setAdd ( double Add ) { add = Add; }

    char getStatus () { return status; }
    double getIncm () { return incm; }
    double getsubtract () { return subtract; }
    double getTaxRate () { return taxRate; }
    double getAdd () { return add; }
    void calcIncome ();
};

//calcIncome
int main () {
    income _new;
    double ajIncome = 0, _incm = 0;
    char status = ' ';
    bool done = false;
    while ( !done ) {
        cout << "Please enter your TAXABLE INCOME:n" << endl;
        cin >> _incm;
        if(cin.fail()) { cin.clear(); }
        if ( _incm <= 0) { cout << "the income must be greater than 0... n" << endl; }
        if ( _incm > 0) { done = true; _new.setIncm(_incm); }
    }

    done = false;
    char stt [2] = " ";
    while ( !done ) {
        cout << "Please declare weather you are filing taxes jointly or single" << "n";
        cout << "t's' = singlent'm' = married" << endl;
        cin >> stt;
        if(cin.fail()) { cin.clear(); }
        if ( status == 's' || status == 'm' ) { done = true; _new.setStatus(stt[0]); }
        //if else { }
    }

    return 0;
};

This is part of a homework assignment so any pointers on bettering my programing would be **great**

Note:I am using Windows 7 with VS express C++ 2008

asked Jan 13, 2010 at 15:44

Wallter's user avatar

WallterWallter

4,2656 gold badges29 silver badges33 bronze badges

3

income is the name of your class. _incm is the name of your variable. Perhaps you meant this (notice the use of _incm not income):

if (_incm <= 0) { cout << "the income must be greater than 0... n" << endl; }
if (_incm > 0) { done = true; _new.setIncm(_incm); }

Frequently you use CamelCase for class names and lowercase for instance variable names. Since C++ is case-sensitive, they wouldn’t conflict each other if they use different case.

answered Jan 13, 2010 at 15:47

Jon-Eric's user avatar

Jon-EricJon-Eric

16.9k9 gold badges65 silver badges97 bronze badges

Your variable is named incom, not income. income refers to a type, so the compiler gets confused and you get a syntax error when you try to compare that type against a value in line 50.

One note for bettering you programming would be to use more distinct variable names to avoid such confusions… ;)

answered Jan 13, 2010 at 15:46

sth's user avatar

sthsth

221k53 gold badges281 silver badges367 bronze badges

1

Студворк — интернет-сервис помощи студентам

Пишу программу для Приложение заполняет исходный массив заданного размера случайными целыми числами из заданного диапазона и переписывает из него в новый массив простые числа. Вроде бы все написал правильно но выдает следующие ошибки.

Ошибка C2059 синтаксическая ошибка: using namespace

C++
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include "MyForm.h"
 
using namespace System;
using namespace System::Windows::Forms;
 
[STAThreadAttribute]
void main(array<String^>^ args) {
    Application::EnableVisualStyles();
    Application::SetCompatibleTextRenderingDefault(false);
 
    
    Lab5::MyForm form;
    Application::Run(% form);
}

Ошибка C1075 «{«: не найдена несоответствующая лексема

Ошибка (активно) E2923 Предупреждение PCH: конец заголовка не в области видимости файла. PCH-файл IntelliSense не был создан.

Посоветуйте как быть. Несколько вариантов перепробовал но приложение не запускается.

description title ms.date f1_keywords helpviewer_keywords ms.assetid

Learn more about: Compiler Error C2059

Compiler Error C2059

03/26/2019

C2059

C2059

2be4eb39-3f37-4b32-8e8d-75835e07c78a

Compiler Error C2059

syntax error : ‘token’

The token caused a syntax error.

The following example generates an error message for the line that declares j.

// C2059e.cpp
// compile with: /c
// C2143 expected
// Error caused by the incorrect use of '*'.
   int j*; // C2059

To determine the cause of the error, examine not only the line that’s listed in the error message, but also the lines above it. If examining the lines yields no clue about the problem, try commenting out the line that’s listed in the error message and perhaps several lines above it.

If the error message occurs on a symbol that immediately follows a typedef variable, make sure that the variable is defined in the source code.

C2059 is raised when a preprocessor symbol name is re-used as an identifier. In the following example, the compiler sees DIGITS.ONE as the number 1, which is not valid as an enum element name:

#define ONE 1

enum class DIGITS {
    ZERO,
    ONE // error C2059
};

You may get C2059 if a symbol evaluates to nothing, as can occur when /Dsymbol= is used to compile.

// C2059a.cpp
// compile with: /DTEST=
#include <stdio.h>

int main() {
   #ifdef TEST
      printf_s("nTEST defined %d", TEST);   // C2059
   #else
      printf_s("nTEST not defined");
   #endif
}

Another case in which C2059 can occur is when you compile an application that specifies a structure in the default arguments for a function. The default value for an argument must be an expression. An initializer list—for example, one that used to initialize a structure—is not an expression. To resolve this problem, define a constructor to perform the required initialization.

The following example generates C2059:

// C2059b.cpp
// compile with: /c
struct ag_type {
   int a;
   float b;
   // Uncomment the following line to resolve.
   // ag_type(int aa, float bb) : a(aa), b(bb) {}
};

void func(ag_type arg = {5, 7.0});   // C2059
void func(ag_type arg = ag_type(5, 7.0));   // OK

C2059 can occur for an ill-formed cast.

The following sample generates C2059:

// C2059c.cpp
// compile with: /clr
using namespace System;
ref class From {};
ref class To : public From {};

int main() {
   From^ refbase = gcnew To();
   To^ refTo = safe_cast<To^>(From^);   // C2059
   To^ refTo2 = safe_cast<To^>(refbase);   // OK
}

C2059 can also occur if you attempt to create a namespace name that contains a period.

The following sample generates C2059:

// C2059d.cpp
// compile with: /c
namespace A.B {}   // C2059

// OK
namespace A  {
   namespace B {}
}

C2059 can occur when an operator that can qualify a name (::, ->, and .) must be followed by the keyword template, as shown in this example:

template <typename T> struct Allocator {
    template <typename U> struct Rebind {
        typedef Allocator<U> Other;
    };
};

template <typename X, typename AY> struct Container {
    typedef typename AY::Rebind<X>::Other AX; // error C2059
};

By default, C++ assumes that AY::Rebind isn’t a template; therefore, the following < is interpreted as a less-than sign. You must tell the compiler explicitly that Rebind is a template so that it can correctly parse the angle bracket. To correct this error, use the template keyword on the dependent type’s name, as shown here:

template <typename T> struct Allocator {
    template <typename U> struct Rebind {
        typedef Allocator<U> Other;
    };
};

template <typename X, typename AY> struct Container {
    typedef typename AY::template Rebind<X>::Other AX; // correct
};

You had quite a few transcription errors. In other words, unless the book is absolutely horrid, you introduced syntax errors on your own when typing the code in. I’ve cleaned it up for you and fixed the syntax errors. Don’t expect me to do it again:

#pragma once

namespace speedgame {
  using namespace System;
  using namespace System::ComponentModel;
  using namespace System::Collections;
  using namespace System::Windows::Forms;
  using namespace System::Data;
  using namespace System::Drawing;

  /// <summary>
  /// Summary for Form1
  ///
  /// WARNING: If you change the name of this class, you will need to change the
  ///          'Resource File Name' property for the managed resource compiler tool
  ///          associated with all .resx files this class depends on.  Otherwise,
  ///          the designers will not be able to interact properly with localized
  ///          resources associated with this form.
  /// </summary>
  public ref class Form1: public System::Windows::Forms::Form {
  public:
    Form1()
    {
      InitializeComponent();
    }

  protected:
    /// <summary>
    /// Clean up any resources being used.
    /// </summary>
    ~Form1()
    {
      if ( components )
        delete components;
    }

  private:
    System::Windows::Forms::ToolTip^  tipControl;
    System::Windows::Forms::Timer^  tmrControl;
    System::Windows::Forms::TextBox^  txtDisplay;
    System::Windows::Forms::TextBox^  txtEntry;
    System::Windows::Forms::Label^  lblInstructions;
    System::Windows::Forms::Label^  lblSourceText;
    System::Windows::Forms::Label^  lblEntryText;
    System::Windows::Forms::StatusStrip^  stsControl;
    System::Windows::Forms::ToolStripStatusLabel^  stsLabel;
    System::Windows::Forms::Button^  btnGo;
    System::Windows::Forms::Button^  btnDone;
    System::Windows::Forms::Button^  btnExit;

    System::ComponentModel::IContainer^  components;

    Int16 intWrong; //Tracks number of strikes
    Int16 intCount; //Tracks number of tries
    Int16 intTimer; //Tracks elapsed time

#pragma region Windows Form Designer generated code
    /// <summary>
    /// Required method for Designer support - do not modify
    /// the contents of this method with the code editor.
    /// </summary>
    void InitializeComponent(void)
    {
      this->components = (gcnew System::ComponentModel::Container());
      this->tipControl = (gcnew System::Windows::Forms::ToolTip(this->components));
      this->txtDisplay = (gcnew System::Windows::Forms::TextBox());
      this->txtEntry = (gcnew System::Windows::Forms::TextBox());
      this->btnGo = (gcnew System::Windows::Forms::Button());
      this->btnDone = (gcnew System::Windows::Forms::Button());
      this->btnExit = (gcnew System::Windows::Forms::Button());
      this->tmrControl = (gcnew System::Windows::Forms::Timer(this->components));
      this->lblInstructions = (gcnew System::Windows::Forms::Label());
      this->lblSourceText = (gcnew System::Windows::Forms::Label());
      this->lblEntryText = (gcnew System::Windows::Forms::Label());
      this->stsControl = (gcnew System::Windows::Forms::StatusStrip());
      this->stsLabel = (gcnew System::Windows::Forms::ToolStripStatusLabel());
      this->stsControl->SuspendLayout();
      this->SuspendLayout();
      // 
      // txtDisplay
      // 
      this->txtDisplay->Location = System::Drawing::Point(40, 55);
      this->txtDisplay->Name = L"txtDisplay";
      this->txtDisplay->ReadOnly = true;
      this->txtDisplay->Size = System::Drawing::Size(675, 20);
      this->txtDisplay->TabIndex = 0;
      this->tipControl->SetToolTip(this->txtDisplay, L"Displays source text string");
      // 
      // txtEntry
      // 
      this->txtEntry->Location = System::Drawing::Point(40, 121);
      this->txtEntry->Name = L"txtEntry";
      this->txtEntry->ReadOnly = true;
      this->txtEntry->Size = System::Drawing::Size(675, 20);
      this->txtEntry->TabIndex = 1;
      this->tipControl->SetToolTip(this->txtEntry, L"Type your text here");
      // 
      // btnGo
      // 
      this->btnGo->Location = System::Drawing::Point(43, 216);
      this->btnGo->Name = L"btnGo";
      this->btnGo->Size = System::Drawing::Size(75, 23);
      this->btnGo->TabIndex = 6;
      this->btnGo->Text = L"GO";
      this->tipControl->SetToolTip(this->btnGo, L"Display new text string");
      this->btnGo->UseVisualStyleBackColor = true;
      this->btnGo->Click += gcnew System::EventHandler(this, &Form1::btnGo_Click);
      // 
      // btnDone
      // 
      this->btnDone->Enabled = false;
      this->btnDone->Location = System::Drawing::Point(639, 216);
      this->btnDone->Name = L"btnDone";
      this->btnDone->Size = System::Drawing::Size(75, 23);
      this->btnDone->TabIndex = 7;
      this->btnDone->Text = L"Done";
      this->tipControl->SetToolTip(this->btnDone, L"Check typing");
      this->btnDone->UseVisualStyleBackColor = true;
      this->btnDone->Click += gcnew System::EventHandler(this, &Form1::btnDone_Click);
      // 
      // btnExit
      // 
      this->btnExit->Location = System::Drawing::Point(639, 9);
      this->btnExit->Name = L"btnExit";
      this->btnExit->Size = System::Drawing::Size(75, 23);
      this->btnExit->TabIndex = 8;
      this->btnExit->Text = L"Exit";
      this->tipControl->SetToolTip(this->btnExit, L"Exit game");
      this->btnExit->UseVisualStyleBackColor = true;
      // 
      // tmrControl
      // 
      this->tmrControl->Interval = 1000;
      this->tmrControl->Tick += gcnew System::EventHandler(this, &Form1::tmrControl_Tick);
      // 
      // lblInstructions
      // 
      this->lblInstructions->AutoSize = true;
      this->lblInstructions->Location = System::Drawing::Point(12, 9);
      this->lblInstructions->Name = L"lblInstructions";
      this->lblInstructions->Size = System::Drawing::Size(511, 13);
      this->lblInstructions->TabIndex = 2;
      this->lblInstructions->Text = L"Click Go to begin. You have 15 seconds to type the text displayed in the source t" 
        L"ext field exactly as shown.";
      // 
      // lblSourceText
      // 
      this->lblSourceText->AutoSize = true;
      this->lblSourceText->Location = System::Drawing::Point(40, 39);
      this->lblSourceText->Name = L"lblSourceText";
      this->lblSourceText->Size = System::Drawing::Size(68, 13);
      this->lblSourceText->TabIndex = 3;
      this->lblSourceText->Text = L"Source Text:";
      // 
      // lblEntryText
      // 
      this->lblEntryText->AutoSize = true;
      this->lblEntryText->Location = System::Drawing::Point(40, 105);
      this->lblEntryText->Name = L"lblEntryText";
      this->lblEntryText->Size = System::Drawing::Size(79, 13);
      this->lblEntryText->TabIndex = 4;
      this->lblEntryText->Text = L"Enter text here:";
      // 
      // stsControl
      // 
      this->stsControl->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(1) {this->stsLabel});
      this->stsControl->Location = System::Drawing::Point(0, 270);
      this->stsControl->Name = L"stsControl";
      this->stsControl->Size = System::Drawing::Size(773, 22);
      this->stsControl->TabIndex = 5;
      this->stsControl->Text = L"statusStrip1";
      // 
      // stsLabel
      // 
      this->stsLabel->Name = L"stsLabel";
      this->stsLabel->Size = System::Drawing::Size(118, 17);
      this->stsLabel->Text = L"toolStripStatusLabel1";
      // 
      // Form1
      // 
      this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
      this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
      this->ClientSize = System::Drawing::Size(773, 292);
      this->Controls->Add(this->btnExit);
      this->Controls->Add(this->btnDone);
      this->Controls->Add(this->btnGo);
      this->Controls->Add(this->stsControl);
      this->Controls->Add(this->lblEntryText);
      this->Controls->Add(this->lblSourceText);
      this->Controls->Add(this->lblInstructions);
      this->Controls->Add(this->txtEntry);
      this->Controls->Add(this->txtDisplay);
      this->FormBorderStyle = System::Windows::Forms::FormBorderStyle::FixedSingle;
      this->Name = L"Form1";
      this->StartPosition = System::Windows::Forms::FormStartPosition::CenterScreen;
      this->Text = L"The Speed Game";
      this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load);
      this->stsControl->ResumeLayout(false);
      this->stsControl->PerformLayout();
      this->ResumeLayout(false);
      this->PerformLayout();

    }
#pragma endregion

    System::Void Form1_Load ( System::Object^ sender, System::EventArgs^ e )
    {
      //set begginning data values
      intWrong = 0;
      intCount = 0;
      intTimer = 0;
    }

    System::Void btnGo_Click ( System::Object^ sender, System::EventArgs^ e )
    {
      //Display game sentences according to level
      if( intCount == 0 )
        txtDisplay->Text = "Once upon a time there where three little pigs.";
      if( intCount == 1 )
        txtDisplay->Text = "In days gone by times where hard but the people were strong.";
      if( intCount == 2 )
        txtDisplay->Text = "Once in awhile something speacial happens even to the worst of people.";
      if( intCount == 3 )
        txtDisplay->Text = "When injustice rears its ugly hea, it is the duty of all good.";
      if( intCount == 4 )
        txtDisplay->Text = "It has been said that in the end there can only be one. Let that one be mighty Molly!";

      btnDone->Enabled = true; //Activate done button
      btnGo->Enabled = false; //Disable Go button

      //Allow text to be entered
      txtEntry->ReadOnly = false;

      //Activate Timer
      tmrControl->Enabled = true;
      intTimer = 0;
      txtEntry->Focus();
    }

    System::Void btnDone_Click ( System::Object^ sender, System::EventArgs^ e )
    {
      //Clear out status bar text
      stsControl->Text = "";

      //Deactivate Timer so it doesn't keep going
      tmrControl->Enabled = false;

      //Make sure player entered something
      if ( String::IsNullOrEmpty ( txtEntry->Text ) ) {
        //Show error
        MessageBox::Show ( "Error: You must enter something!" );
        //reset game
        txtDisplay->Text = "";
        btnDone->Enabled = false;
        btnGo->Enabled = true;
        txtEntry->ReadOnly = true;
        intTimer = 0;
        btnGo->Focus();
        return;
      }

      if ( String::Compare ( txtEntry->Text, txtDisplay->Text ) == 0 ) {
        //handle Correct answer
        MessageBox::Show ( "Match! You typed the string in correctly!" );
        intCount += 1;
        intTimer = 0;
      }
      else {
        //handle incorrect answer
        MessageBox::Show ( String::Concat ( "Strike ",
          intWrong.ToString(), "! You made at least",
          " one typo." ) );
        intTimer = 0;
      }

      //get set up for the next level
      txtEntry->Text = "";
      txtDisplay->Text = "";
      btnDone->Enabled = false;
      btnGo->Enabled = true;
      txtEntry->ReadOnly = true;
      intTimer = 0;
      btnGo->Focus();

      //handle 3 strikes
      if ( intWrong == 3 ) {
        //inform play he/she is a begginer
        if ( intCount < 2 ) {
          MessageBox::Show ( "Game Over! Your "
            "typing skill level is Beginner. "
            "Please play again!" );
          intCount = 0;
          intWrong = 0;
          return;
        }

        //inform play he/she is intermediate
        if ( intCount < 4 ) {
          MessageBox::Show ( "Game Over! Your "
            "typing skill level is intermediate. "
            "Please play again!" );
          intCount = 0;
          intWrong = 0;
          return;
        }

        //inform play he/she is advanced
        if ( intCount < 5 ) {
          MessageBox::Show ( "Game Over! Your "
            "typing skill level is advanced. "
            "Please play again!" );
          intCount = 0;
          intWrong = 0;
          return;
        }
      }
    }

    System::Void btnExit_Click ( System::Object^ sender, System::EventArgs^	e )
    {
      this->Close();
    }

    System::Void tmrControl_Tick ( System::Object^ sender, System::EventArgs^ e )
    {
      //update timer value
      intTimer += 1;
      Int16 intTimeRemain = 15 - intTimer;
      stsLabel->Text = "Seconds remaining: ";
      stsLabel->Text = String::Concat( stsLabel, intTimeRemain.ToString() );

      //handle running out of time
      if ( intTimer == 15 ) {
        intWrong += 1;
        tmrControl->Enabled = false;
        stsLabel->Text = "";
        MessageBox::Show ( String::Concat ( "Strike ",
          intWrong.ToString(), " - Time is up! Please",
          " try again." ) );

        //reset game
        txtEntry->Text = "";
        txtDisplay->Text = "";
        btnDone->Enabled = false;
        btnGo->Enabled = true;
        txtEntry->ReadOnly = true;
        intTimer = 0;
        btnGo->Focus();

        //handle 3 strikes
        if ( intWrong == 3 ) {
          //inform play he/she is a begginer
          if ( intCount < 2 ) {
            MessageBox::Show ( "Game Over! Your "
              "typing skill level is Beginner. "
              "Please play again!" );
            intCount = 0;
            intWrong = 0;
            return;
          }

          //inform play he/she is intermediate
          if ( intCount < 4 ) {
            MessageBox::Show ( "Game Over! Your "
              "typing skill level is intermediate. "
              "Please play again!" );
            intCount = 0;
            intWrong = 0;
            return;
          }

          //inform play he/she is advanced
          if( intCount < 5 ) {
            MessageBox::Show ( "Game Over! Your "
              "typing skill level is advanced. "
              "Please play again!" );
            intCount = 0;
            intWrong = 0;
            return;
          }
        }

        //player is an expert!
        if ( intCount >= 5 ) {
          intCount = 0;
          intWrong = 0;
          MessageBox::Show ( "Game Complete! Your "
            "typing skill level is Expert! "
            "Please try again!" );
        }
      }
    }
  };
}

Here are a few C++ tips:

1) Classes always end with a semicolon.
2) public, private, and protected are groupings. You don’t have to specify an access modifier for every single member.
3) C++ is case sensitive. int16 is quite different from Int16.
4) Every opening { has to have a corresponding closing }.

Solved


When I try to compile this program i keep getting these errors:

(50) : error C2059: syntax error :
‘<=’

(50) : error C2143: syntax error
: missing ‘;’ before ‘{‘

(51) : error
C2059: syntax error : ‘>’

(51) : error
C2143: syntax error : missing ‘;’
before ‘{‘

(62) : error C2059: syntax
error : ‘else’

(62) : error C2143:
syntax error : missing ‘;’ before ‘{‘


#include <iostream>
#include <string>
#include <cassert>
using namespace std;

class income {
private:
    double incm;
    double subtract;
    double taxRate;
    double add;
    char status;
public:
    void setStatus ( char stats ) { status = stats; }
    void setIncm (double in ) { incm = in; }
    void setSubtract ( double sub ) { subtract = sub; }
    void setTaxRate ( double rate ) { taxRate = rate; }
    void setAdd ( double Add ) { add = Add; }

    char getStatus () { return status; }
    double getIncm () { return incm; }
    double getsubtract () { return subtract; }
    double getTaxRate () { return taxRate; }
    double getAdd () { return add; }
    void calcIncome ();
};

//calcIncome
int main () {
    income _new;
    double ajIncome = 0, _incm = 0;
    char status = ' ';
    bool done = false;
    while ( !done ) {
        cout << "Please enter your TAXABLE INCOME:n" << endl;
        cin >> _incm;
        if(cin.fail()) { cin.clear(); }
        if ( _incm <= 0) { cout << "the income must be greater than 0... n" << endl; }
        if ( _incm > 0) { done = true; _new.setIncm(_incm); }
    }

    done = false;
    char stt [2] = " ";
    while ( !done ) {
        cout << "Please declare weather you are filing taxes jointly or single" << "n";
        cout << "t's' = singlent'm' = married" << endl;
        cin >> stt;
        if(cin.fail()) { cin.clear(); }
        if ( status == 's' || status == 'm' ) { done = true; _new.setStatus(stt[0]); }
        //if else { }
    }

    return 0;
};

This is part of a homework assignment so any pointers on bettering my programing would be **great**

Note:I am using Windows 7 with VS express C++ 2008

asked Jan 13, 2010 at 15:44

Wallter's user avatar

WallterWallter

4,2656 gold badges29 silver badges33 bronze badges

3

income is the name of your class. _incm is the name of your variable. Perhaps you meant this (notice the use of _incm not income):

if (_incm <= 0) { cout << "the income must be greater than 0... n" << endl; }
if (_incm > 0) { done = true; _new.setIncm(_incm); }

Frequently you use CamelCase for class names and lowercase for instance variable names. Since C++ is case-sensitive, they wouldn’t conflict each other if they use different case.

answered Jan 13, 2010 at 15:47

Jon-Eric's user avatar

Jon-EricJon-Eric

16.9k9 gold badges65 silver badges96 bronze badges

Your variable is named incom, not income. income refers to a type, so the compiler gets confused and you get a syntax error when you try to compare that type against a value in line 50.

One note for bettering you programming would be to use more distinct variable names to avoid such confusions… ;)

answered Jan 13, 2010 at 15:46

sth's user avatar

sthsth

221k53 gold badges281 silver badges367 bronze badges

1

Студворк — интернет-сервис помощи студентам

Пишу программу для Приложение заполняет исходный массив заданного размера случайными целыми числами из заданного диапазона и переписывает из него в новый массив простые числа. Вроде бы все написал правильно но выдает следующие ошибки.

Ошибка C2059 синтаксическая ошибка: using namespace

C++
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include "MyForm.h"
 
using namespace System;
using namespace System::Windows::Forms;
 
[STAThreadAttribute]
void main(array<String^>^ args) {
    Application::EnableVisualStyles();
    Application::SetCompatibleTextRenderingDefault(false);
 
    
    Lab5::MyForm form;
    Application::Run(% form);
}

Ошибка C1075 «{«: не найдена несоответствующая лексема

Ошибка (активно) E2923 Предупреждение PCH: конец заголовка не в области видимости файла. PCH-файл IntelliSense не был создан.

Посоветуйте как быть. Несколько вариантов перепробовал но приложение не запускается.

See more:










#include "stdafx.h"
#include "parser.h"
#include "HashTable.h"
#include "CountFrequency.h"

#include <iostream>
#include <string>
#include <cstring>
using namespace std;
























void parser(string line, int fileNo, class HashTable & HT, frequencyList FL[])
{
        
        char * cStr, * cPtr;
        string tempString;

        
        
        cStr = new char [line.size() + 1];
        strcpy (cStr, line.c_str());

        
        cPtr = strtok (cStr, " ");
        while (cPtr != NULL)
        {
                if (strcmp(cPtr, "</TEXT>") != 0 && *cPtr != '.')
                {
                        tempString = string(cPtr);

                        
                        removeCommaBehind(tempString);

                        
                        removePeriodBehind(tempString);

                        
                        removePBehind(tempString);

                        
                        removePBefore(tempString);

                        
                        removeApsBehind(tempString);

                        
                        removeApBehind(tempString);

                        
                        removeIesBehind(tempString);

                        
                        removeSLBefore(tempString);

                        
                        removeEsBehind(tempString);

                        
                        removeSBehind(tempString);

                        
                        removeIngBehind(tempString);

                        
                        removeEdBehind(tempString);

                        
                        if(tempString.compare("a") != 0)
                        if(tempString.compare("an") != 0)
                        if(tempString.compare("any") != 0)
                        if(tempString.compare("all") != 0)
                        if(tempString.compare("and") != 0)
                        if(tempString.compare("are") != 0)
                        if(tempString.compare("at") != 0)
                        if(tempString.compare("as") != 0)
                        if(tempString.compare("b") != 0)
                        if(tempString.compare("be") != 0)
                        if(tempString.compare("been") != 0)
                        if(tempString.compare("but") != 0)
                        if(tempString.compare("by") != 0)
                        if(tempString.compare("c") != 0)
                        if(tempString.compare("ca") != 0)
                        if(tempString.compare("can") != 0)
                        if(tempString.compare("d") != 0)
                        if(tempString.compare("e") != 0)
                        if(tempString.compare("f") != 0)
                        if(tempString.compare("for") != 0)
                        if(tempString.compare("from") != 0)
                        if(tempString.compare("g") != 0)
                        if(tempString.compare("ga") != 0)
                        if(tempString.compare("h") != 0)
                        if(tempString.compare("ha") != 0)
                        if(tempString.compare("had") != 0)
                        if(tempString.compare("have") != 0)
                        if(tempString.compare("he") != 0)
                        if(tempString.compare("i") != 0)
                        if(tempString.compare("in") != 0)
                        if(tempString.compare("is") != 0)
                        if(tempString.compare("it") != 0)
                        if(tempString.compare("j") != 0)
                        if(tempString.compare("k") != 0)
                        if(tempString.compare("l") != 0)
                        if(tempString.compare("like") != 0)
                        if(tempString.compare("m") != 0)
                        if(tempString.compare("me") != 0)
                        if(tempString.compare("my") != 0)
                        if(tempString.compare("n") != 0)
                        if(tempString.compare("near") != 0)
                        if(tempString.compare("no") != 0)
                        if(tempString.compare("not") != 0)
                        if(tempString.compare("o") != 0)
                        if(tempString.compare("of") != 0)
                        if(tempString.compare("on") != 0)
                        if(tempString.compare("or") != 0)
                        if(tempString.compare("out") != 0)
                        if(tempString.compare("over") != 0)
                        if(tempString.compare("p") != 0)
                        if(tempString.compare("q") != 0)
                        if(tempString.compare("r") != 0)
                        if(tempString.compare("s") != 0)
                        if(tempString.compare("she") != 0)
                        if(tempString.compare("so") != 0)
                        if(tempString.compare("t") != 0)
                        if(tempString.compare("that") != 0)
                        if(tempString.compare("th") != 0)
                        if(tempString.compare("the") != 0)
                        if(tempString.compare("them") != 0)
                        if(tempString.compare("their") != 0)
                        if(tempString.compare("they") != 0)
                        if(tempString.compare("this") != 0)
                        if(tempString.compare("to") != 0)
                        if(tempString.compare("u") != 0)
                        if(tempString.compare("up") != 0)
                        if(tempString.compare("us") != 0)
                        if(tempString.compare("v") != 0)
                        if(tempString.compare("w") != 0)
                        if(tempString.compare("wa") != 0)
                        if(tempString.compare("was") != 0)
                        if(tempString.compare("we") != 0)
                        if(tempString.compare("were") != 0)
                        if(tempString.compare("which") != 0)
                        if(tempString.compare("who") != 0)
                        if(tempString.compare("will") != 0)
                        if(tempString.compare("with") != 0)
                        if(tempString.compare("x") != 0)
                        if(tempString.compare("y") != 0)
                        if(tempString.compare("z") != 0)
                        if(tempString.compare("") != 0)
                        if(tempString.compare("n") != 0)
                        if(tempString.compare(" ") != 0)
                        if(tempString.compare(" n") != 0)
                        if(tempString.compare("n") != 0)
                        if(tempString.compare(",") != 0)
                        if(tempString.compare(".") != 0)
                        if(tempString.compare("=") != 0)
                        {
                                
                                countFrequency(tempString, FL);
                        }
                }
                cPtr = strtok(NULL, "()/ ");
        }
        delete[] cStr;
}






void removeCommaBehind(string &tempString)
{
        if(tempString.find(",", tempString.length() - 2) < 35)
        {
                tempString.replace(tempString.find(",", tempString.length() - 2), tempString.length(), "");
        }
}






void removePeriodBehind(string &tempString)
{
        if(tempString.find(".", tempString.length() - 2) < 35)
        {
                tempString.replace(tempString.find(".", tempString.length() - 2), tempString.length(), "");
        }
}






void removeSLBefore(string &tempString)
{
        if(tempString[0] == '/')
                tempString.erase(0, 1);
}






void removeIesBehind(string &tempString)
{
        if(tempString.find("ies", tempString.length() - 3) < 35)
        {
                tempString.replace(tempString.find("ies", tempString.length() - 3), tempString.length(), "y");
        }
}






void removeEsBehind(string &tempString)
{
        if(tempString.find("sses", tempString.length() - 4) < 35)
        {
                tempString.replace(tempString.find("sses", tempString.length() - 4), tempString.length(), "ss");
        }
}






void removeSBehind(string &tempString)
{
        if(tempString.find("s", tempString.length() - 1) < 35)
        {
                tempString.replace(tempString.find("s", tempString.length() - 1), tempString.length(), "");
        }
}






void removeIngBehind(string &tempString)
{
        if(tempString.find("ing", tempString.length() - 3) < 35)
        {
                tempString.replace(tempString.find("ing", tempString.length() - 3), tempString.length(), "");
        }
}






void removeEdBehind(string &tempString)
{
        if(tempString.find("ed", tempString.length() - 2) < 35)
        {
                tempString.replace(tempString.find("ed", tempString.length() - 2), tempString.length(), "");
        }
}






void removeApsBehind(string &tempString)
{
        if(tempString.find("'s", tempString.length() - 2) < 35)
        {
                tempString.replace(tempString.find("'s", tempString.length() - 2), tempString.length(), "");
        }
}






void removeApBehind(string &tempString);
void removeApBehind(string &tempString)
{
        if(tempString.find("'", tempString.length() - 2) < 35)
        {
                tempString.replace(tempString.find("'", tempString.length() - 2), tempString.length(), "");
        }
}






void removePBefore(string &tempString)
{
        if(tempString[0] == '(')
                tempString.erase(0, 1);
}






void removePBehind(string &tempString)
{
        if(tempString.find(")", tempString.length() - 2) < 35)
        {
                tempString.replace(tempString.find(")", tempString.length() - 2), tempString.length(), "");
        }
}



  • Ошибка c2011 переопределение типа class
  • Ошибка c2011 timespec переопределение типа struct
  • Ошибка c200d mazda 6 gh
  • Ошибка c2002 фрилендер 2
  • Ошибка c2000 kyocera 2035