Variants
Views
Actions

Difference between revisions of "Cppreference:Archives"

From cppreference.com
Line 1: Line 1:
+
#include <iostream>
 
+
#include <math.h>
#include<cstdio>
+
#include<iostream>
+
#include<vector>
+
#include<cstring>
+
  
 
using namespace std;
 
using namespace std;
  
int lungime(string s) {
+
int main()
    return s.size();
+
{
}
+
float l1, l2, l3, p, P, A;
 
+
cout<<"l1=";
bool CompareStart(string s1,char s) {
+
cin>>l1;
    if(s1[0] == tolower(s) || s1[0] == toupper(s)) {
+
cout<<"l2=";
        return true;
+
cin>>l2;
    }
+
cout<<"l3=";
    else return false;
+
cin>>l3;
}
+
 
+
bool CompareEnd(string s1,char f) {
+
    if(s1[s1.size()-1] == tolower(f) || s1[s1.size()-1] == toupper(f)) {
+
        return true;
+
    }
+
    else return false;
+
}
+
  
int main() {
+
P=l1+l2+l3;
    vector<string>cuvinte;
+
cout<<"Perimetrul triunghiului oarecare este: "<<P;
    string cuvant;
+
p=(l1+l2+l3)/2;
    int nr1,nr2,i;
+
cout<<"\n"<<"Semiperimetrul triunghiului oarecare este: "<<p;
    int s1=0,s2=0,s3=0;
+
A=sqrt((p)*(p-l1)*(p-l2)*(p-l3));
    char s,f;
+
cout<<"\n"<<"Aria triunghiului oarecare este: "<<A;
    cin>>s>>f;
+
    cin>>nr1>>nr2;
+
    while(cin>>cuvant) {
+
        cuvinte.push_back(cuvant);
+
    }
+
    for(i=0;i<cuvinte.size();i++) {
+
        if(cuvinte[i].size()<nr1 &&CompareStart(cuvinte[i],s)==1&&CompareEnd(cuvinte[i],f)==1) {
+
            s1++;
+
        }
+
        if(CompareStart(cuvinte[i],s)==1&&CompareEnd(cuvinte[i],f)==1&&cuvinte[i].size()>=nr1&&cuvinte[i].size()<nr2) {
+
            s2++;
+
        }
+
        if(CompareStart(cuvinte[i],s)==1&&CompareEnd(cuvinte[i],f)==1&&cuvinte[i].size()>=nr2) {
+
            s3++;
+
        }
+
    }
+
    cout<<s1<<" "<<s2<<" "<<s3<<endl;
+
    return 0;
+
 
}
 
}

Revision as of 03:58, 16 January 2020

  1. include <iostream>
  2. include <math.h>

using namespace std;

int main() { float l1, l2, l3, p, P, A; cout<<"l1="; cin>>l1; cout<<"l2="; cin>>l2; cout<<"l3="; cin>>l3;

P=l1+l2+l3; cout<<"Perimetrul triunghiului oarecare este: "<<P; p=(l1+l2+l3)/2; cout<<"\n"<<"Semiperimetrul triunghiului oarecare este: "<<p; A=sqrt((p)*(p-l1)*(p-l2)*(p-l3)); cout<<"\n"<<"Aria triunghiului oarecare este: "<<A; }