有人可以帮我解决这个错误..我不明白,我已经尝试解决,但没有结果。谢谢]]

问题描述 投票:0回答:1

我的c ++代码无法正常工作。我需要一些帮助。该代码包含非英语单词,它们位于我的母语languange中,但它们要求输入一个三角形,正方形,矩形和圆形的参数。必须计算其中之一的周长和面积

#include <iostream>
#include <cmath>
using namespace std;
bool trekendeshi(double ,double ,double );
double Lloji_Tr(double , double ,double );
double P(double,double,double);
double S(double,double,double);
double per1(double);
double sip1(double);
double per2(double,double);
double sip2(double,double);
double per3(double);
double sip3(double);
int main()
{
    double a,b,c;
    int z;
    char loop='y';
    while (loop='y')
    {
    cout<<" Vendos 1 per trekendesh";
    cout<<"\n2 Vendos 2 per katror";
    cout <<"\n3 Vendos 3 per drejtkendesh";
    cout<<"\n4 Vendos 4 per rreth \n";
    cin>>z;
    switch(z)
    {
    case 1:
    {
        cout<<"\nVendosni brinjet e trekendeshit:";
        cin>>a>>b>>c;}
   bool trekendeshi(double a ,double b ,double c ){
   double a,b,c;
       if ( a+b>=c)
       return true;
       else
       return false;
       cout<<"Nuk plotesohet kushti qe te brinjet te formojne trekendesh\n";
   }
    }
      double Lloji_Tr(double a, double b ,double c ) {
      double a,b,c;
          if(a=b=c)
          cout<<"Trekendesh barabrinjes\n";
               {
                   if((a=b)|| (b=c)|| (a=c))
              cout <<"Trekendesh dybrinjeshem\n";}
              else
              cout<<"Trekendesh cfardo\n";
    }
         double P(double a,double b,double c) {
             double p;
             p=(a+b+c);
             return p;
         }
       double S(double a,double b,double c){
           double p,s;
           p=(a+b+c)/2;
        s=sqrt(p*(p-a)*(p-b)*(p-c));
        return s;
        break;
       }
      }
      case 2:
      {
         cout<<"\nVendosni brinjet e katrorit:";
        cin>>a;
       double per1(double a) {
           return ( 4*a);
       }
       double sip1(double){
           return (a*a);
           break;
       }
      }
      case 3:
      {
    cout<<"\nVendosni brinjet e drejkendeshit:";
    cin>>a>>b;
    double per2(double a,double b){
        return (2*(a+b));
    }
    double sip2(double a,double b){
        return (a*b);
        break;
    }
   }
   case 4:
   {
      cout<<"\nVendosni rrezen e rrethit:";
        cin>>r;
       double per3(double r) {
           return (2*3.14*r)
   }
   double sip3(double r){
       return (3.14*r*r);
       break;
   }
   }
   cout<<"Doni te perserisni veprimet? Shtypni y per Po dhe n per Jo:";
 cin>>loop;
 cout<<"Faleminderit per bashkepunimin tuaj";
 if (loop=='y'){
  continue;}
  if (loop=='n'){
      break;
  }
}
    return 0;
}
}

我的c ++代码无法正常工作。我需要一些帮助。代码中包含非英语单词,它们位于我的母语languange中,但它们要求输入的参数为三角形,正方形,矩形和...

c++ function switch-statement
1个回答
0
投票
#include <iostream>
#include <cmath>
using namespace std;
bool trekendeshi(double ,double ,double );
double Lloji_Tr(double , double ,double );
double P(double,double,double);
double S(double,double,double);
double per1(double);
double sip1(double);
double per2(double,double);
double sip2(double,double);
double per3(double);
double sip3(double);
int main()
{
    double a,b,c;
    int z;
    char loop='y';
    while (loop='y')
    {
    cout<<" Vendos 1 per trekendesh";
    cout<<"\n2 Vendos 2 per katror";
    cout <<"\n3 Vendos 3 per drejtkendesh";
    cout<<"\n4 Vendos 4 per rreth \n";
    cin>>z;
    switch(z)
    {
    case 1:
    {
        cout<<"\nVendosni brinjet e trekendeshit:";
        cin>>a>>b>>c;}
   bool trekendeshi(double a ,double b ,double c ){
   double a,b,c;
       if ( a+b>=c)
       return true;
       else
       return false;
       cout<<"Nuk plotesohet kushti qe te brinjet te formojne trekendesh\n";
   }
    }
      double Lloji_Tr(double a, double b ,double c ) {
      double a,b,c;
          if(a=b=c)
          cout<<"Trekendesh barabrinjes\n";
               {
                   if((a=b)|| (b=c)|| (a=c))
              cout <<"Trekendesh dybrinjeshem\n";}
              else
              cout<<"Trekendesh cfardo\n";
    }
         double P(double a,double b,double c) { //Postcondition: Returns the perimeter and area of a triangle. 

             double p;
             p=(a+b+c);
             return p;
         }
       double S(double a,double b,double c){
           double p,s;
           p=(a+b+c)/2;
        s=sqrt(p*(p-a)*(p-b)*(p-c));
        return s;
        break;
       }
      }
      case 2:
      {
         cout<<"\nVendosni brinjet e katrorit:";
        cin>>a;
       double per1(double a) {
           return ( 4*a);
       }
       double sip1(double){
           return (a*a);
           break;
       }
      }
      case 3:
      {
    cout<<"\nVendosni brinjet e drejkendeshit:";
    cin>>a>>b;
    double per2(double a,double b){
        return (2*(a+b));
    }
    double sip2(double a,double b){
        return (a*b);
        break;
    }
   }
   case 4:
   {
      cout<<"\nVendosni rrezen e rrethit:";
        cin>>r;
       double per3(double r) {
           return (2*3.14*r)
   }
   double sip3(double r){
       return (3.14*r*r);
       break;
   }
   }
   cout<<"Doni te perserisni veprimet? Shtypni y per Po dhe n per Jo:";
 cin>>loop;
 cout<<"Faleminderit per bashkepunimin tuaj";
 if (loop=='y'){
  continue;}
  if (loop=='n'){
      break;
  }
}
    return 0;
}
}
© www.soinside.com 2019 - 2024. All rights reserved.