Newbie Question

TFLNemesis's Avatar, Join Date: Mar 2008
Newbie Member
Hi All

I have a newbie problem, I am very new to C programming and am studying it as part of a degree course in the uk. We have to use C specifically not C# or C++.

I am currently running Bloodshed Dev-C++ V4.9.9.2 on Windows XP Professional Version 2002 Service pack 3 V.3264

My problem is this;

Having written and compiled a simple program;
Code:
#include <stdio.h>

int main(void)
{     float x,y  ;                                    
      printf(" Please input 2 integers\n"); 
      scanf("%f %f", &x, &y);                
      printf("\nThe two integers are:\n %f %f\n",x, y);
      system("PAUSE");                               
      return 0;
}
tested it and it works how i want, i then edited the program to;

Code:
#include <stdio.h>

int main(void)
{     float x,y  ;                                   
      printf("Please input 2 integers\n");
      scanf("%f %f", &x, &y);               
      printf("\nThe two integers are:\n%f %2f\n",x,y);
      system("PAUSE");                                
      return 0;
}
only a simple variation on the original program, but when i compile the new edited program (after having saved it as a new source file) it acts exactly as the original unedited program within Dev-C++.

Closing out Dev-C++ and reopening the source file makes no difference, even rebooting my computer and then opening the source file again with Dev-C++ makes no difference, the executed program acts exactly as the original unedited program.

This is driving me nuts and causing my work to take 3-4 times as long as it should.

Does anyone have any idea where i am going wrong adn what i need to do to stop this happening?

Thanks TFLNemesis

Last edited by shabbir; 18Mar2008 at 10:02.. Reason: Code block - http://www.go4expert.com/forums/misc.php?do=bbcode#code
asadullah.ansari's Avatar, Join Date: Jan 2008
TechCake
difference is there
first program layout
Code:
asadulla ~/test> g++ temp6.cpp
execution gcc-3.3.1/g++ (gprs/pcusa_passport_sas)
asadulla ~/test> ./a.out
Please input 2 integers
12 34

The two integers are:
12.000000 34.000000
second program senario is

Code:
asadulla ~/test> g++ temp6.cpp
execution gcc-3.3.1/g++ (gprs/pcusa_passport_sas)
asadulla ~/test> ./a.out
 Please input 2 integers
12 34

The two integers are:
 12.000000 34.000000