| | |
help needed in floating point
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Jun 2005
Posts: 15
Reputation:
Solved Threads: 0
I have 2 problems in C regarding floating point, please help :
Q1
Output of the following code- C.
But if we change the if condition from a<0.7 to a<0.7f we get output- C++.
Q2
The following code gives runtime error- Floating point formats not linked. When does this error occur in a program.
Q1
Output of the following code- C.
C++ Syntax (Toggle Plain Text)
main() { float a=0.7; if(a<0.7) printf("C"); else printf("C++); }
Q2
The following code gives runtime error- Floating point formats not linked. When does this error occur in a program.
C++ Syntax (Toggle Plain Text)
main() { struct emp { char name[20]; float sal; }; struct emp e[10]; int i; for(i=0;i<=9;i++) scanf("%s %f",e[i]name,&e[i].sal); }
C++ Syntax (Toggle Plain Text)
#include <stdio.h> #define BUFSZ 255 struct lala { char name[BUFSZ]; unsigned age; // for example :-) } student[10]; int main(void) { for(int i=0; i < 10; i++) scanf("%s %d", &student[i].name, &student[i].age); // Using scanf() for reading strings is in general not a good idea. // Look at fgets(). It is more precise and can prevent overflows. return 0; }
"One of the methods used by statists to destroy capitalism consists in establishing controls that tie a given industry hand and foot, making it unable to solve its problems, then declaring that freedom has failed and stronger controls are necessary." --Ayn Rand
![]() |
Similar Threads
- a simple way to print a binary representation of a floating point number? (C++)
- Dynamic Array, Writing to CSV, Floating Point ?'s (C)
- FLOATING POINT.......Please (C++)
- IEEE Floating-point fromat (C)
- Floating Point Representation (Computer Science)
- Drop 0 in floating point variable 0.233 (C++)
- Floating point numbers (C++)
- floating point (C++)
Other Threads in the C++ Forum
- Previous Thread: coding problem
- Next Thread: Linking Error...
| Thread Tools | Search this Thread |
api application array arrays based beginner binary bitmap c++ c/c++ calculator char char* class classes code coding compile compiler console conversion convert count data database delete deploy developer dll download dynamiccharacterarray email encryption error file forms fstream function functions game generator getline givemetehcodez graph homeworkhelp homeworkhelper iamthwee ifstream input int java lib list loop looping loops map math matrix memory multiple news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference rpg sorting string strings temperature template text text-file tree url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






