i dont understand why this isnt working ill post the code thats relevent
for some reason no matter what numbers i enter it will just print out that the complex number is 0.00000... idk how to fix it
heres the main function
#include <stdio.h>
#include "globals.h"
#include "complex.h"
int main( int argc, char *argv[] ){
complex complex1, complex2, complex3 ;
double r, i;
printf( "Complex 1: Please enter two floating point values: " );
scanf( "%1f", &r ) ; scanf( "%1f", &i ) ;
complex1 = load_complex( r, i );
printf( "\nThe complex number is " ); print_complex( complex1 );
printf( "\n" );
print_complex function
/*******************************************************************/
/* Programmer: Jonathan Doucette */
/* complex.c */
/*******************************************************************/
#include "globals.h"
#include "complex.h"
#include <stdio.h>
void print_complex( complex complex1 ){
printf( "%1f ", complex1.real ) ;
printf( "%1f ", complex1.imaginary ) ;
return ;
}
and the complex macro
#ifndef _complex
#define _complex
#include "globals.h"
typedef struct complex { double real ; double imaginary ; } complex ;