0% found this document useful (0 votes)
77 views2 pages

1 GH

This document contains 6 code snippets written in C++ that demonstrate simple math and logic programs: 1) A program that calculates twice a user-input number plus one 2) A program that calculates the area of a trapezoid given user-input dimensions 3) A program that converts degrees, minutes, seconds to radians 4) A program that calculates the slope of a line given two points or indicates there is no slope 5) A program that checks if a triangle exists given three side lengths 6) The code snippets perform basic input/output and math calculations to solve simple problems.

Uploaded by

KatyHoshi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
77 views2 pages

1 GH

This document contains 6 code snippets written in C++ that demonstrate simple math and logic programs: 1) A program that calculates twice a user-input number plus one 2) A program that calculates the area of a trapezoid given user-input dimensions 3) A program that converts degrees, minutes, seconds to radians 4) A program that calculates the slope of a line given two points or indicates there is no slope 5) A program that checks if a triangle exists given three side lengths 6) The code snippets perform basic input/output and math calculations to solve simple problems.

Uploaded by

KatyHoshi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

int a;

cout<<"Ingrese un numero:";
cin>>a;
cout<<"El resultado es:"
<<2*a+1<<endl;
system("PAUSE") ;
}
3
//calcula el area de
//un trapecio
#include<iostream>
#include<cstdlib>
using namespace std;
int main () {
float a,b,h;
cout<<"a=";

Ejercicios

cin>>a;

cout<<"b=";

#include<iostream>

cin>>b;

using namespace std;

cout<<"h=";

int main () {

cin>>h;

int a;

float area=0.5*h*(a+b);

cin>>a;

cout<<"El area es "<<area

cout<<2*a+1<<endl;

<<endl;

system ("PAUSE") ;

system ("PAUSE");

#include<iostream>

//convierte ABC" A radianes

#include<cstdlib>

#include<iostream>

using namespace std;

#include<cstdlib>

int main () {

using namespace std;

int main() {

cout<<"No hay pendiente"<<endl;

float A, B, C;

} else {

cout<<"A=";cin>>A;

float m=(y2-y1)/(x2-x1);

cout<<"B=";cin>>B;

cout<<"m="<<m<<endl;

cout<<"C=";cin>>C;

float r, pi;

system ("PAUSE");

pi=3.141592;

r = A*pi/180 + B/60*pi/180

+ C/3600*pi/180;

//existencia de un triangulo

cout<<"r="<<" rad"<<endl;

#include<iostream>

system ("PAUSE");

#include<cstdlib>

using namespace std;

int main() {
//calcular la pendiente de una recta

float a,b,c;

#include<iostream>

cout<<"a=";cin>>a;

#include<cstdlib>

cout<<"b=";cin>>b;

using namespace std;

cout<<"c=";cin>>c;

int main() {

if ( ( a<0b+c)&(b<0a+b) ){

float x1,y1,x2,y2;
cout<<"x1=";cin>>x1;
cout<<"y1=";cin>>y1;
cout<<"x2=";cin>>x2;
cout<<"y2=";cin>>y2;
if (x1=x2){

cout<<"Triangulo existe."<<endl;
} else {
cout<<"Triangulo no
existe."<<endl;
}
system ("PAUSE");

You might also like