Vector 创建新的向量,该向量使用从keybord键入的范围和0.25的步长

Vector 创建新的向量,该向量使用从keybord键入的范围和0.25的步长,vector,Vector,我必须创建一个代码来创建新的向量,它是由用户键入的范围创建的。 例如:我们从3开始,以9结束。所以我需要3到9的板条箱向量,步进0.25 #include <stdio.h> #include <stdlib.h> #include <math.h> int main() { float starts=0; float ends=0; float stepo = 0.25; float tab[]={}; int sta

我必须创建一个代码来创建新的向量,它是由用户键入的范围创建的。 例如:我们从3开始,以9结束。所以我需要3到9的板条箱向量,步进0.25

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main()
{
    float starts=0;
    float ends=0;
    float stepo = 0.25;
    float tab[]={};
    int startInt = 0;
    int endInt = 0;
    int counter = 0;
    printf("Podaj poczatek:\n");// "Type starting int"
    scanf("%d", &endInt);
    printf("Podaj koniec:\n"); // "Type ending int"
    scanf("%d", &startInt); 
    int diff = startInt - endInt;
    printf("%d\n", diff);
    starts= startInt;
    ends= endInt;
    for (int i = 0; i< (diff)*4; i++) {
        tab[i]= ends;
        printf("%f\n", tab[i]);**strong text**
        ends = ends + stepo;
    }
    return 0;
}
#包括
#包括
#包括
int main()
{
浮动开始=0;
浮动端=0;
浮动步长o=0.25;
浮动选项卡[]={};
int startInt=0;
int-endInt=0;
int计数器=0;
printf(“Podaj poczatek:\n”);/“键入起始int”
scanf(“%d”、&endInt);
printf(“Podaj konice:\n”);/“类型结束int”
scanf(“%d”和startInt);
int diff=起始点-结束点;
printf(“%d\n”,差异);
开始=开始;
结束=结束;
对于(int i=0;i<(diff)*4;i++){
表[i]=结束;
printf(“%f\n”,制表符[i]);**强文本**
ends=ends+stepo;
}
返回0;
}
我自己解决了;-)“float tab[]={};”这是个问题

 #include <stdio.h>
  #include <stdlib.h>
  #include <math.h>

    int main()
           {
    float starts=0;
    float ends=0;
    float stepo = 0.25;

    printf("Podaj poczatek:\n");
    scanf("%f", &ends);
    printf("Podaj koniec:\n");
    scanf("%f", &starts);
    float diff = starts - ends;
    printf("%f\n", diff);
    int tabSize = diff *4;
    float tab[tabSize];

    for (int i = 0; i<=diff*4; i++){
        tab[i]= ends;
        printf("%8.2f\n", tab[i]);
        ends = ends + stepo;

    }

    return 0;
 }
#包括
#包括
#包括
int main()
{
浮动开始=0;
浮动端=0;
浮动步长o=0.25;
printf(“Podaj poczatek:\n”);
scanf(“%f”,&ends);
printf(“Podaj koniec:\n”);
scanf(“%f”,开始(&S);
浮动差异=开始-结束;
printf(“%f\n”,差异);
int tabSize=diff*4;
浮动选项卡[选项卡大小];
对于(inti=0;i我自己解决了;-)“float tab[]={}”,这是个问题

 #include <stdio.h>
  #include <stdlib.h>
  #include <math.h>

    int main()
           {
    float starts=0;
    float ends=0;
    float stepo = 0.25;

    printf("Podaj poczatek:\n");
    scanf("%f", &ends);
    printf("Podaj koniec:\n");
    scanf("%f", &starts);
    float diff = starts - ends;
    printf("%f\n", diff);
    int tabSize = diff *4;
    float tab[tabSize];

    for (int i = 0; i<=diff*4; i++){
        tab[i]= ends;
        printf("%8.2f\n", tab[i]);
        ends = ends + stepo;

    }

    return 0;
 }
#包括
#包括
#包括
int main()
{
浮动开始=0;
浮动端=0;
浮动步长o=0.25;
printf(“Podaj poczatek:\n”);
scanf(“%f”,&ends);
printf(“Podaj koniec:\n”);
scanf(“%f”,开始(&S);
浮动差异=开始-结束;
printf(“%f\n”,差异);
int tabSize=diff*4;
浮动选项卡[选项卡大小];

for(int i=0;ifor循环只需要4个atepmpts for循环只需要4个atepmpts