BeRG's Profile
Reputation: 0
Apprentice
- Group:
- New Members
- Active Posts:
- 5 (0.02 per day)
- Joined:
- 07-October 12
- Profile Views:
- 495
- Last Active:
Oct 10 2012 10:31 PM- Currently:
- Offline
Previous Fields
- Country:
- PT
- OS Preference:
- Windows
- Favorite Browser:
- FireFox
- Favorite Processor:
- Intel
- Favorite Gaming Platform:
- PC
- Your Car:
- Ford
- Dream Kudos:
- 0
Latest Visitors
Posts I've Made
-
In Topic: 12 errors
Posted 9 Oct 2012
Salem_c, on 09 October 2012 - 12:24 PM, said:
BeRG, on 08 October 2012 - 09:32 AM, said:
Salem_c, on 07 October 2012 - 10:22 PM, said:> 029 valores = new float [valores];
Are you writing C or C++?
Because apart from this single line, the rest of the code is C.
> 1>c:\users\vladimir\desktop\ficha1\ficha1\ficha1.cpp(
Which means you should create a file called ficha1.c instead.
It will mean you'll get further errors when you try to sneak in bits of C++ without realising it (such as calls to new).
It's C
Weird then that you're still using new/delete.
It's like you just ignored half of what was said.
Becouse it's beging. I'm study recently in university this language C. and i'm mistaken it's C++. sorry, but thanks for all help. it's relly very fast ansver
-
In Topic: 12 errors
Posted 9 Oct 2012
I can do it
#include <stdio.h> #include <math.h> float menor(float lista[], int n); float maior(float lista[],int n); void main() { int i,g; int b1,b2,b3,b4,b5,b6,b7,b8,b9; int frab[10]={0}; float frel[10]={0}; float inf, sup, p, a, c; int nlinhas; FILE *pfile; // Apontador para uma estrutura de um ficheiro char nome_ficheiro[]= {"C:\\Users\\Vladimir\\Desktop\\(1)\\Ficha1\\DOC\\Teste.txt"}; // String com o nome do ficheiro float * valores;// Apontador para o Array dinamico que guarda os valores lidos do ficheiro pfile= fopen(nome_ficheiro, "r"); if(pfile == NULL) printf("ERRO NA ABERTURA DO FICHEIRO"); else { fscanf(pfile, "%d", &nlinhas); valores = new float [nlinhas]; for (i=0; i<nlinhas; i++) { fscanf(pfile, "%f", &valores[i]); } p=(maior(valores, nlinhas) - menor(valores, nlinhas))/10; b1=menor(valores, nlinhas) + p; b2=b1 + p; b3=b2 + p; b4=b3 + p; b5=b4 + p; b6=b5 + p; b7=b6 + p; b8=b7 + p; b9=b8 + p; for (i=0; i<nlinhas; i++) { if (valores[i]>=menor(valores, nlinhas) && valores[i]<b1) ++frab[0]; else if(valores[i]>=b1 && valores[i]<b2) ++frab[1]; else if(valores[i]>=b2 && valores[i]<b3) ++frab[2]; else if(valores[i]>=b3 && valores[i]<b4) ++frab[3]; else if(valores[i]>=b4 && valores[i]<b5) ++frab[4]; else if(valores[i]>=b5 && valores[i]<b6) ++frab[5]; else if(valores[i]>=b6 && valores[i]<b7) ++frab[6]; else if(valores[i]>=b7 && valores[i]<b8) ++frab[7]; else if(valores[i]>=b8 && valores[i]<b9) ++frab[8]; else if(valores[i]>=b9 && valores[i]<=maior(valores, nlinhas)) ++frab[9]; } } i=0; inf=menor(valores, nlinhas); sup=p; printf("\n Limites \t Frequencia Absoluta \t Frequencia Relativa \t Grafico \n\n"); do { a=nlinhas/100.00; c=float(frab[i])/a; frel[i]= c; printf(" %5.2f a %.2f\t %d\t %3.2f\t ",inf,sup,frab[i],frel[i]); for(g=1;g<=frab[i];++g) { printf("*"); } printf("\n"); inf+=p; sup+=p; i++; } while(i<10); delete [] valores; } float menor(float lista[], int n) { float min=lista[0]; int i; for(i=1; i<n; i++) { if(lista[i]<min) { min=lista[i]; } } return min; } float maior(float lista[],int n) { float max=lista[0]; int i; for(i=1; i<n; i++) { if(lista[i]>max) { max=lista[i]; } } return max; } -
In Topic: 12 errors
Posted 8 Oct 2012
Salem_c, on 07 October 2012 - 10:22 PM, said:> 029 valores = new float [valores];
Are you writing C or C++?
Because apart from this single line, the rest of the code is C.
> 1>c:\users\vladimir\desktop\ficha1\ficha1\ficha1.cpp(
Which means you should create a file called ficha1.c instead.
It will mean you'll get further errors when you try to sneak in bits of C++ without realising it (such as calls to new).
It's C -
In Topic: 12 errors
Posted 7 Oct 2012
jimblumberg, on 07 October 2012 - 01:34 PM, said:Do you have a problem or question?
If you are getting error messages, post the complete error messages exactly as they appear in your development environment.
Jim
Hello
I have problem, becouse i don't know where from error and as can corect they
sorri for my very bed english
thnks
BeRG, on 07 October 2012 - 01:50 PM, said:
jimblumberg, on 07 October 2012 - 01:34 PM, said:Do you have a problem or question?
If you are getting error messages, post the complete error messages exactly as they appear in your development environment.
Jim
Hello
I have problem, becouse i don't know where from error and as can corect they
sorri for my very bed english
thnks
show me this
1>------ Build started: Project: Ficha1, Configuration: Debug Win32 ------
1>Compiling...
1>Ficha1.cpp
1>c:\users\vladimir\desktop\ficha1\ficha1\ficha1.cpp(22) : warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> c:\program files (x86)\microsoft visual studio 8\vc\include\stdio.h(234) : see declaration of 'fopen'
1>c:\users\vladimir\desktop\ficha1\ficha1\ficha1.cpp(28) : warning C4996: 'fscanf': This function or variable may be unsafe. Consider using fscanf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> c:\program files (x86)\microsoft visual studio 8\vc\include\stdio.h(249) : see declaration of 'fscanf'
1>c:\users\vladimir\desktop\ficha1\ficha1\ficha1.cpp(29) : error C2440: 'initializing' : cannot convert from 'float *' to 'size_t'
1> There is no context in which this conversion is possible
1>c:\users\vladimir\desktop\ficha1\ficha1\ficha1.cpp(33) : error C2296: '+' : illegal, left operand has type 'float (__cdecl *)(float [],int)'
1>c:\users\vladimir\desktop\ficha1\ficha1\ficha1.cpp(34) : warning C4244: '=' : conversion from 'float' to 'int', possible loss of data
1>c:\users\vladimir\desktop\ficha1\ficha1\ficha1.cpp(35) : warning C4244: '=' : conversion from 'float' to 'int', possible loss of data
1>c:\users\vladimir\desktop\ficha1\ficha1\ficha1.cpp(36) : warning C4244: '=' : conversion from 'float' to 'int', possible loss of data
1>c:\users\vladimir\desktop\ficha1\ficha1\ficha1.cpp(37) : warning C4244: '=' : conversion from 'float' to 'int', possible loss of data
1>c:\users\vladimir\desktop\ficha1\ficha1\ficha1.cpp(38) : warning C4244: '=' : conversion from 'float' to 'int', possible loss of data
1>c:\users\vladimir\desktop\ficha1\ficha1\ficha1.cpp(39) : warning C4244: '=' : conversion from 'float' to 'int', possible loss of data
1>c:\users\vladimir\desktop\ficha1\ficha1\ficha1.cpp(40) : warning C4244: '=' : conversion from 'float' to 'int', possible loss of data
1>c:\users\vladimir\desktop\ficha1\ficha1\ficha1.cpp(41) : warning C4244: '=' : conversion from 'float' to 'int', possible loss of data
1>c:\users\vladimir\desktop\ficha1\ficha1\ficha1.cpp(49) : error C2446: '>=' : no conversion from 'float (__cdecl *)(float [],int)' to 'float'
1> There is no context in which this conversion is possible
1>c:\users\vladimir\desktop\ficha1\ficha1\ficha1.cpp(49) : error C2440: '>=' : cannot convert from 'float (__cdecl *)(float [],int)' to 'float'
1>c:\users\vladimir\desktop\ficha1\ficha1\ficha1.cpp(58) : error C2446: '<=' : no conversion from 'float (__cdecl *)(float [],int)' to 'float'
1> There is no context in which this conversion is possible
1>c:\users\vladimir\desktop\ficha1\ficha1\ficha1.cpp(58) : error C2440: '<=' : cannot convert from 'float (__cdecl *)(float [],int)' to 'float'
1>c:\users\vladimir\desktop\ficha1\ficha1\ficha1.cpp(68) : error C2086: 'int i' : redefinition
1> c:\users\vladimir\desktop\ficha1\ficha1\ficha1.cpp(11) : see declaration of 'i'
1>c:\users\vladimir\desktop\ficha1\ficha1\ficha1.cpp(69) : error C2086: 'float inf' : redefinition
1> c:\users\vladimir\desktop\ficha1\ficha1\ficha1.cpp(15) : see declaration of 'inf'
1>c:\users\vladimir\desktop\ficha1\ficha1\ficha1.cpp(69) : error C2440: 'initializing' : cannot convert from 'float (__cdecl *)(float [],int)' to 'float'
1> Context does not allow for disambiguation of overloaded function
1>c:\users\vladimir\desktop\ficha1\ficha1\ficha1.cpp(70) : error C2086: 'float sup' : redefinition
1> c:\users\vladimir\desktop\ficha1\ficha1\ficha1.cpp(15) : see declaration of 'sup'
1>c:\users\vladimir\desktop\ficha1\ficha1\ficha1.cpp(77) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
1>c:\users\vladimir\desktop\ficha1\ficha1\ficha1.cpp(79) : error C2563: mismatch in formal parameter list
1>c:\users\vladimir\desktop\ficha1\ficha1\ficha1.cpp(98) : error C2447: '{' : missing function header (old-style formal list?)
1>Build log was saved at "file://c:\Users\Vladimir\Desktop\Ficha1\Ficha1\Debug\BuildLog.htm"
1>Ficha1 - 12 error(s), 11 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
My Information
- Member Title:
- New D.I.C Head
- Age:
- 21 years old
- Birthday:
- December 26, 1991
- Gender:
-
Contact Information
- E-mail:
- Private
Friends
|
|


Find Topics
Find Posts
View Reputation Given

|
Comments
BeRG has no profile comments yet. Why not say hello?