A couple of years back I made an attempt at learning C++. I'm now trying to take it back up, here is an attempt:
#include <stdio.h>
int main()
{
int xo,xt,yo,yt;
float grad;
printf("Enter the first co-ordinate:\n");
scanf("%d",&xo);
scanf("%d",&yo);
printf("And the second one:\n");
scanf("%d",&xt);
scanf("%d",&yt);
grad = (yo-yt)/(xo-xt);
printf("Chord of (%d",xo);printf(",%d",yo);printf(")");
printf(" and (%d",xt);printf(",%d",yt);printf(")\n");
printf("Gradient: %f",grad);
scanf("%f",grad);
return 0;
}
The issue I found was that it wouldn't work when I tried printf("string",variable,"string"); so I ended up having to do lots and lots of printf()s. Now I seem to remember another method of output that went something like
cout >>> "string" >>> variable;
But I can't remember how to do that.