Pagini: [1]   În jos
  Imprimă  
Ajutor Subiect: Suma divizorilor  (Citit de 6921 ori)
0 Utilizatori şi 1 Vizitator pe acest subiect.
miculprogramator
Nu mai tace
*****

Karma: 65
Deconectat Deconectat

Mesaje: 306



Vezi Profilul
« : Aprilie 12, 2009, 14:48:55 »

Salut! Smile Am rezolvat si eu o problema pe forum si nu inteleg de ce imi afiseaza eroare de compilare.La mine pe calculator functioneaza perfect! As avea nevoie de niste lamuriri, verau sa castig si eu puncte.

Aceasta este sursa:
Cod:
#include <fstream.h>   
#include <conio.h>   
#include <math.h>   
int main()   
{   
clrscr();   
fstream f("sumdiv.in",ios::in),g("sumdiv.out",ios::out);   
int a,b,s=0,i,r=0,p=0;   
f>>a>>b;   
p=pow(a,b);   
for (i=1;i<=p;i++)   
if ( p%i==0) s+=i;   
r=s%9901;   
g<<r;   
f.close();   
g.close();   
return 0;   
}   

Iar acestea erorile:

Citat
Eroare de compilare:
In file included from /usr/include/c++/4.2/backward/fstream.h:31,
                 from user.cpp:1:
/usr/include/c++/4.2/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the <X> header for the <X.h> header for C++ includes, or <iostream> instead of the deprecated header <iostream.h>. To disable this warning use -Wno-deprecated.
user.cpp:2:19: error: conio.h: No such file or directory
user.cpp: In function 'int main()':
user.cpp:6: error: 'clrscr' was not declared in this scope
user.cpp:7: error: 'ios' has not been declared
user.cpp:7: error: 'ios' has not been declared
Memorat
Mishu91
Nu mai tace
*****

Karma: 169
Deconectat Deconectat

Mesaje: 751



Vezi Profilul
« Răspunde #1 : Aprilie 12, 2009, 14:56:19 »

clrscr nu este recunoscuta de compilator(de altfel nici nu inteleg de ce o folosesti), iar cand deschizi fisierele foloseste ifstream si ofstream Smile
Memorat
miculprogramator
Nu mai tace
*****

Karma: 65
Deconectat Deconectat

Mesaje: 306



Vezi Profilul
« Răspunde #2 : Aprilie 12, 2009, 15:00:19 »

adica ceva de genul asta:

Cod:
istream f("sumdiv.un");
ofstream g("sumdiv.out");

asta-i tot? pot sa o pun din nou?
Memorat
wefgef
Nu mai tace
*****

Karma: 1049
Deconectat Deconectat

Mesaje: 3.008


razboinicu' luminii


Vezi Profilul
« Răspunde #3 : Aprilie 12, 2009, 16:22:15 »

Poti sa o pui din nou, dar ai grija sa nu incluzi conio.h
Memorat

omului i-au fost date instinctele pentru a supravietui, nu pentru a fi sclavul lor.
miculprogramator
Nu mai tace
*****

Karma: 65
Deconectat Deconectat

Mesaje: 306



Vezi Profilul
« Răspunde #4 : Aprilie 12, 2009, 16:32:02 »

Eroare de compilare:
In file included from /usr/include/c++/4.2/backward/fstream.h:31,
                 from user.cpp:1:
/usr/include/c++/4.2/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the <X> header for the <X.h> header for C++ includes, or <iostream> instead of the deprecated header <iostream.h>. To disable this warning use -Wno-deprecated.
user.cpp: In function 'int main()':
user.cpp:5: error: 'ios' has not been declared
user.cpp:5: error: 'ios' has not been declared
   
Memorat
pauldb
Nu mai tace
*****

Karma: 821
Deconectat Deconectat

Mesaje: 1.901



Vezi Profilul
« Răspunde #5 : Aprilie 13, 2009, 09:57:25 »

Include librariile <iostream> si <fstream> (fara .h) si adauga "using namespace std;" (inainte de int main() undeva).
« Ultima modificare: Aprilie 13, 2009, 10:13:29 de către Paul-Dan Baltescu » Memorat

Am zis Mr. Green
miculprogramator
Nu mai tace
*****

Karma: 65
Deconectat Deconectat

Mesaje: 306



Vezi Profilul
« Răspunde #6 : Aprilie 13, 2009, 10:02:44 »

si <math.h> ramane cu h?
in compilator nu-mi accepta <iostream> si <fstream>  Huh
Memorat
pauldb
Nu mai tace
*****

Karma: 821
Deconectat Deconectat

Mesaje: 1.901



Vezi Profilul
« Răspunde #7 : Aprilie 13, 2009, 10:12:58 »

Lucrezi in Borland C?
Memorat

Am zis Mr. Green
miculprogramator
Nu mai tace
*****

Karma: 65
Deconectat Deconectat

Mesaje: 306



Vezi Profilul
« Răspunde #8 : Aprilie 13, 2009, 10:19:12 »

da, am inlocuit fstream f("sumdiv.in",ios::in) etc...
cu ifstream si ofstream. sa vad daca merge

edit:

Citat
Compilare:
In file included from /usr/include/c++/4.2/backward/fstream.h:31,
                 from user.cpp:1:
/usr/include/c++/4.2/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the <X> header for the <X.h> header for C++ includes, or <iostream> instead of the deprecated header <iostream.h>. To disable this warning use -Wno-deprecated.

Memorat
Pagini: [1]   În sus
  Imprimă  
 
Schimbă forumul:  

Powered by SMF 1.1.19 | SMF © 2006-2013, Simple Machines