我的IDE说“所需项目中存在错误。继续启动?”

时间:2015-01-25 00:08:59

标签: c++ arrays eclipse function

我的IDE说“所需项目中存在错误。继续启动?”。通过发射尝试达到48%。但是没有显示任何突出显示的错误。 我正在使用Eclipse indigo release 2。 其他一些用户说他们发生了类似的事情,并且他们最近从他们的硬盘驱动器中删除了文件,我做了但没有关于eclipse或c ++的内容。

#include <iostream>
#include <string>

using namespace std;
void search(char wrd2[26]);

bool srch(char wrd[26], char ch);
int pos(char wrd[26], char ch);
int cntr(char wrd[26], char ch);

void revr(char wrd2[26], char wrd1[26]);

void chcs(char wrd2[26], char wrd1[26]);

void re_ch(char wrd2[26], char wrd1[26]);

int main()
{

char wrd1[26], wrd2[26];

int  opt=0;
cout<<"Please enter two word words."<<endl;
cout<<""<<endl;
cout<<"Please insert your first word here:";
cin>>wrd1;
cout<<""<<endl;
cout<<"Enter your second word here :";
cin>>wrd2;
cout<<endl;


do{

    cout<<"Search enter 1:"<<endl;
    cout<<endl;
    cout<<"Reverse enter 2:"<<endl;
    cout<<endl;
    cout<<"Change the case enter 3:"<<endl;
    cout<<endl;
    cout<<"Reverse and change the case enter 4:"<<endl;
    cout<<endl;
    cout<<"Change your first word enter 5:"<<endl;
    cout<<endl;
    cout<<"Change your second word enter 6:"<<endl;
    cout<<endl;
    cout<<"Quit enter 7:"<<endl;

    cin>>opt;
    cout<<endl;



    if (opt==1){
     search(wrd2);
    }

    if (opt==2){
revr(wrd2,wrd1);


    }

    if (opt==3){
chcs(wrd2,wrd1);
    }
    if (opt==4){
re_ch(wrd2,wrd1);
    }

    if (opt==5){
 cout<<"Please change your first word here:";
 cin>>wrd1;
 cout<<""<<endl;
        }


    if (opt==6){
 cout<<"Please change your second word here:";
 cin>>wrd2;
 cout<<""<<endl;
        }

 }
    while(opt !=7);
    if(opt==7)
    cout<<"good bye";



}

我的代码对您有效吗?我的IDE再次没有出现错误的迹象。

void search(char wrd2[26])
{    bool fnd=false;
char ch;
int x=0, cnt=0;
cout<<"Please enter in a character you would like to search for:";
            cin>>ch;
            cout<<""<<endl;
            fnd=srch(wrd2,ch);
            cnt=cntr(wrd2,ch);
            x=pos(wrd2,ch);


            if(fnd==true)
            {
                cout<<"Yes! Your character was found! :) ";
                if(cnt==1)
                {

                    if(x==0)
                    {
                            cout<<ch<<" is the "<<x+1<<"st letter of the                  word "<<wrd2<<".";
                    }

                    if(x==1)
                    {
                            cout<<ch<<" is the "<<x+1<<"nd letter of the word "<<wrd2<<".";
                    }

                    if(x==2)
                    {
                            cout<<ch<<" is the "<<x+1<<"rd letter of the word "<<wrd2<<".";
                    }
                    if(x>2)
                    {
                            cout<<ch<<" is the "<<x+1<<"th letter of the word "<<wrd2<<".";
                    }

                    cout<<" There is "<<cnt<<" letter "<<ch<<" in the word "<<wrd2<<"."<<endl;
                    cout<<" "<<endl;

                }

                if(cnt>1)
                {
                    if(x==0)
                    {
                        cout<<"It first appears as the "<<x+1<<"st letter of the word. ";
                    }

                    if(x==1)
                    {
                        cout<<"It first appears as the "<<x+1<<"nd letter of the word. ";
                    }

                    if(x==2)
                    {
                        cout<<"It first appears as the "<<x+1<<"rd letter of the word. ";
                    }
                    if(x>2)
                    {
                        cout<<"It first appears as the "<<x+1<<"th letter of the word. ";
                    }

                    cout<<"There is "<<cnt<<" "<<ch<<"'s in the word "<<wrd2<<"."<<endl;
                    cout<<" "<<endl;
                }
            }




            else
            {
                cout<<"Your character "<<ch<<" was not found in the word "<<wrd2<<". :("<<endl;
                cout<<""<<endl;
            }





}



bool srch(char wrd[26], char ch)
{
int x=0;
bool fnd=false;
for(x=0; x<=25; x++)
{
    if(wrd[x]==ch)
    {

         fnd=true;
         return fnd;
         break;
    }

    }

if(!fnd)
{
    return fnd;
}

return 0;
}

int pos(char wrd[26], char ch)
{
for(int x=0;x<26;x++)
  {
        if (wrd[x] == ch)
        {
            return x;
        }
  }

return 0;
}

int cntr(char wrd[26], char ch)
{
int cnt=0;
int x=0;
for(x=0;x<26;x++)
{
    if (wrd[x] == ch)
    {
        cnt++;
    }

}

return cnt;
return 0;
}

void revr(char wrd2[26],char wrd1[26])
{
int s,x;

s=strlen(wrd2)-1;

cout<<"Your second word "<<wrd2<<" reversed added to first = ";
cout<<wrd1;
for(x=s;x>=0;x--)
{
    cout<<(wrd2[x]);
}
cout<<" "<<endl;
cout<<" "<<endl;

}

void chcs(char wrd2[26], char wrd1[26])
{
char ch;
int s,x;

s=strlen(wrd2)-1;

cout<<"Your second word with case changed proceeded by the first = ";
cout<<wrd1;
for(x=0;x<=s;x++)
 {
    if(wrd2[x]>= 65 && wrd2[x] <= 90) //is it upper?
     ch=wrd2[x]+32;
    else if(wrd2[x]>= 97 && wrd2[x] <= 122)  //is it lower?
      ch=wrd2[x]-32;
         else
         ch=1;   //invlaid char - mark with smiley face

    cout<<ch;
 }cout<<endl;
 }

void re_ch(char wrd2[26], char wrd1[26])
{
    char ch;
    int s,x;

    s=strlen(wrd2)-1;

    //cout<<"String with case changed = ";
     cout<<"Your second reversed and with the case changed procceeded by       the first"<<endl;
     cout<<" "<<endl;
    cout<<wrd1;
     for(x=s;x>=0;x--)
     {
        if(wrd2[x]>= 65 && wrd2[x] <= 90) //is it upper?
         ch=wrd2[x]+32;
        else if(wrd2[x]>= 97 && wrd2[x] <= 122)  //is it lower?
          ch=wrd2[x]-32;
             else
             ch=1;   //invlaid char - mark with smiley face

        cout<<ch;
     }cout<<" "<<endl;
      cout<<" "<<endl;
}

我该怎么办?

1 个答案:

答案 0 :(得分:0)

我有类似的问题。关闭并重新开启日食为我做了。