Clasified in Notes of Computers of Bachelor.
Written at June 14, 2010 on
English with a size of 1,143 bytes.
STRING
Obtenção de substrings
Podem ser utilizados os métodos assign ou substr:
string s1 = "Mackenzie", s2, s3;
s2.assign(s1); // Copia s1 para s2 (mesmo que s2 = s1;)
cout << s2 << endl; // Exibe Mackenzie
s3.assign(s1,0,4); // Copia 4 car. de s1 para s3 começando em 0
cout << s3 << endl; // Exibe Mack
cout << s1.substr(0,4) << endl; // Exibe Mack
Em Linguagem C++ (usando método da classe):
string s = "Sergio";
cout << s.length() << endl; // Exibe 6
string s1 = "abcdef";
s1.erase(2,3);
cout << s1 << endl; // Exibe abf
s1.insert(2,"cde");
cout << s1 << endl; // Exibe abcdef
string frase = "Universidade Faculdade Escola";
int p;
p = frase.find("dade",0);
cout << p << endl; // Exibe 8
p = frase.find("dade",13);
Clasified in Notes of Computers of Bachelor.
Written at June 14, 2010 on
English with a size of 1,172 bytes.
ENCAPSULAMENTO
#include <iostream>
#include <cmath>
using namespace std;
class Ponto
{
private:
double x;
double y;
public:
void setRet(double x, double y);
void getRet(double &x, double &y);
void setPol(double a, double r);
void getPol(double &a, double &r);
};
void Ponto::setRet(double x, double y)
{
this->x = x;
this->y = y;
}
void Ponto::getRet(double &x, double &y)
{
x = this->x;
y = this->y;
}
void Ponto::setPol(double a, double r)
{
x = r * cos(a);
y = r * sin(a);
}
void Ponto::getPol(double &a, double &r)
{
a = atan(y/x);
r = sqrt(x*x+y*y);
}
int main(int argc, char *argv[])
{
Ponto p1, p2;
double x, y, a, r;
p1.setRet(2,2);
p1.getPol(a,r);
cout << "a = " << a << " e r = " << r << endl;
Clasified in Homeworks of Computers of Bachelor.
Written at June 14, 2010 on
English with a size of 3,835 bytes.
MAIN
#include <cstdlib>
#include <iostream>
#include <string>
#include "triangulo.h"
using namespace std;
int main()
{
triangulo tri;
double areat,peri;
string nomet;
tri.setladoa(5);
tri.setladob(4);
tri.setladoc(9);
peri=tri.perimetro(peri);
areat=tri.area(areat);
tri.classifica(nomet);
cout << "Lado a :"<< tri.getladoa()<<endl;
cout << "Lado b :"<< tri.getladob()<<endl;
cout << "Lado c :"<< tri.getladoc()<<endl;
cout << "Perimetro:"<< peri<<endl;
cout << "Area :"<< areat<<endl;
tri.classifica(nomet);
system("PAUSE");
return EXIT_SUCCESS;
... (Continue)Clasified in Notes of Computers of Bachelor.
Written at November 09, 2009 on
English with a size of 1,680 bytes.
LUNAS
Dim i As Integer
Private Sub Form_Load()
End Sub
Private Sub imairudi_Click()
End Sub
Private Sub Timer1_Timer()
imairudi = imailargi(i)
i = i + 1
If i = 7 Then
i = 0
End If
End Sub
SACERDOTE
Private Sub Cmdonartu_Click()
If txthitza = "sacerdote" Then
lblasmatu = "Zorionak asmatu duzu!"
Else
lblasmatu = "ez duzu asmatu"
End If
If txthitza = "sacerdote" Then
imadolar.Visible = True
End If
End Sub
Private Sub Image1_Click()
End Sub
Private Sub Form_Load()
End Sub
... (Continue)
Clasified in Notes of Computers of Bachelor.
Written at May 31, 2009 on
English with a size of 831 bytes.
Clasified in Notes of Computers of Bachelor.
Written at May 31, 2009 on
English with a size of 830 bytes.
Clasified in Notes of Computers of Bachelor.
Written at May 21, 2009 on
English with a size of 469 bytes.
Clasified in Notes of Computers of Bachelor.
Written at May 21, 2009 on
English with a size of 329 bytes.
Clasified in Notes of Computers of Bachelor.
Written at May 31, 2009 on
English with a size of 915 bytes.
Clasified in Notes of Computers of Bachelor.
Written at May 31, 2009 on
English with a size of 791 bytes.