小编Tim*_*ams的帖子

C scanf int into struct

我试图将一些整数读入结构中.我让用户输入两个三维向量并返回两个交叉积和点积.

它似乎正在跳过第二个向量的第二个值.到目前为止,这是我的代码:

/** Write a program to calculate cross-products and dot products of 
**  a 3-dimensional vector:
**  
 **    1. Uses a type definition
**    2. Accepts User input of qty(2) 3-dimensional vectors
**    3. Calculate the cross-product of A x B and B x A                         
**    4. Calculate the dot product A * B
**
******************************************************************/


/************* Preprocessor Functions       **********************/
#include <stdio.h>
#include <stdlib.h>


/************ Structured Data Types ***************************/

typedef struct vector
{
    int x;
    int y;
    int z; …
Run Code Online (Sandbox Code Playgroud)

c struct scanf

1
推荐指数
1
解决办法
3万
查看次数

标签 统计

c ×1

scanf ×1

struct ×1