Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct vector3D
- {
- double x, y, z;
- };
- int main()
- {
- vector3D v;
- printf("Introduce las tres componentes de un vector3D");
- printf("nComp. 1: "); scanf("%f", &v.x);
- printf("Comp. 2: "); scanf("%f", &v.y);
- printf("Comp. 3: "); scanf("%f", &v.z);
- printf("%f", v.x); // Aquí muestra un valor que no tiene nada que ver con lo
- // que he tecleado previamente y me impide hacer otros cálculos
- return 0;
- }
- typedef struct VECTOR3D {
- double x, y, z;
- } vector3D;
- vector3D v;
- struct vector3D v;
- #include <stdio.h>
- struct vector3D
- {
- double x, y, z;
- };
- int main()
- {
- struct vector3D v;
- printf("Introduce las tres componentes de un vector3D");
- printf("nComp. 1: "); scanf("%f", &v.x);
- printf("Comp. 2: "); scanf("%f", &v.y);
- printf("Comp. 3: "); scanf("%f", &v.z);
- printf("%lfn", v.x);
- return 0;
- }
- Introduce las tres componentes de un vector3D
- Comp. 1: 2
- Comp. 2: 3
- Comp. 3: 1
- 2.000000
- int main()
- {
- vector3D v;
- std::cout << "Introduce las tres componentes de un vector3Dn";
- std::cout "Comp. 1: ";
- std::cin >> v.x;
- std::cout "Comp. 2: ";
- std::cin >> v.y;
- std::cout "Comp. 3: ";
- std::cin >> v.z;
- std::cout << v.x;
- return 0;
- }
- float S E E E E E E E E M M M M M M M M M M M M M M M M M M M M M M M
- double S E E E E E E E E E E E M M M M M M M M M M M M M M M M M M M M M M M M M ..... M
- float 0 1 1 0 0 1 1 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 1
- double 0 1 1 0 0 1 1 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 1 M M M M M ..... M
Add Comment
Please, Sign In to add comment