- Joined
- Sep 9, 2021
- Messages
- 9,682
- Reaction score
- 5,219
- Awards
- 32
This will be an ongoing posting of code that does not compile. As the title states, these are programs that were meant to be useful, but dont compile and ar for that reason deemed worthless. These will be good practice for seasoned or beginner programmers who know the C programming language, like to solve problems, and need practice on debugging program to get them to compile and run.
First wonder model of C code used to sum imaginary numbers following this logic:
The "imaginary" number is j. The example problem is computing the square root of -1, using the following equation to build complex numbers x and y, z is the result:
z = x + jy
Here is the non compiling C code called complexnum.c
#include "stdio.h"
#include "stdlib.h"
#include "math.h"
#include "float.h"
int main(void)
{
double j,x,y,z =0.0;
printf("\nPleast enter two numbers: ");
scanf("%f %f",&j,&y);
z=x+(j*y);
printf("The sum is %0.f",&z);
return 0;
}
Again, this is meant to be educational. If I solve a given problem, I will post my code. If you figure it out before me, feel free to post your sample code.
First wonder model of C code used to sum imaginary numbers following this logic:
The "imaginary" number is j. The example problem is computing the square root of -1, using the following equation to build complex numbers x and y, z is the result:
z = x + jy
Here is the non compiling C code called complexnum.c
#include "stdio.h"
#include "stdlib.h"
#include "math.h"
#include "float.h"
int main(void)
{
double j,x,y,z =0.0;
printf("\nPleast enter two numbers: ");
scanf("%f %f",&j,&y);
z=x+(j*y);
printf("The sum is %0.f",&z);
return 0;
}
Again, this is meant to be educational. If I solve a given problem, I will post my code. If you figure it out before me, feel free to post your sample code.