h=0.01;
c=1;
τ=(h/(2  c));
T=3;
n=Ceiling[10/h];
m=Ceiling[T/τ];
u0[x_]:=({{\[Piecewise], ({{1, 1/4≤x≤3/4}, {1-Abs[4x-6], 5/4≤x≤7/4}, {Cos[Pi(2x-5)], 9/4≤ x≤ 11/4}, {0, True}})}})
y=Table[0,{n+1},{m+1}];
x=Table[i h,{i,0,n}];
For[i=1, i≤n+1, i++,
y[[i,1]]=u0[x[[i]]]
];
For[j=1, j≤m, j++,
For[i=2,i≤n,i++,
y[[i,j+1]]=(1-c τ/h)y[[i,j]]+c τ/h y[[i-1,j]]
];
y[[1,j+1]]=0;
y[[n+1,j+1]]=0;
]

Manipulate[
plot1=ListLinePlot[Table[{x[[i]],y[[i,j]]},{i,1,n+1}],PlotRange->{{0,6},{0,1}}];
plot2=Plot[u0[x-c j τ],{x,0,10},PlotStyle->Red,ExclusionsStyle->Red];
Show[plot1,plot2]
,
{j,1,m+1,1}
]

y[[2]]

τ