473,387 Members | 3,820 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

errors with operand "!=" ???

Hi, i'm doing a project in Visual C++....in Portuguese....i'm hoping you can help figure out the problem eventhough it's not in english...

here is the whole code....incomplete in the int main and it's missing some functions but i wanted to solve this errors before i keep going

Class.h
Expand|Select|Wrap|Line Numbers
  1. class CNoFila{
  2.   public:
  3.     int evento;
  4.     int tempo;
  5.     int numcliente;
  6.     int numlugar;
  7.     int tempochegada;
  8.     CNoFila *Proximo;
  9. };
  10.  
  11.  
  12.  
  13. class CFilaLavagem{
  14.     CNoFila *InicioLav;
  15.     CNoFila *FimLav;
  16.   public:
  17.     CFilaLavagem(void);                      //constructor por defeito
  18.     ~CFilaLavagem(void);                 //Destructor
  19.     friend class CFilaEstacionamento;
  20.     void ApagaItemLav(int numcliente);
  21.     int lugareslavagem(void);
  22.     friend bool spot(int n1, int tempo, int evento, int &carrosout, int numcliente, int numlugar, int tempochegada);
  23.     void EstacParaLavagem(CNoFila &L);
  24.     void InsereItemLav(int evento, int tempo, int numcliente, int tempochegada);
  25.     int NumLugarLav(int n1);
  26.     friend void Simulacao(CNoFila &Actual, int &t, int n1, int &carrosout, int n2);
  27. };
  28.  
  29.  
  30. class CFilaEstacionamento{
  31.  
  32.   public:
  33.     CNoFila *InicioEstac;
  34.     CNoFila *FimEstac;
  35.     CFilaEstacionamento();                      //constructor por defeito
  36.     CFilaEstacionamento(const CNoFila & L);
  37.     ~CFilaEstacionamento(void);                 //Destructor
  38.  
  39.     void ApagaItemEstac(void);
  40.     int lugaresestacionamento(void);
  41.     friend bool spot(int n1, int tempo, int evento, int &carrosout, int numcliente, int numlugar, int tempochegada);
  42.     friend class CFilaLavagem;
  43.     void InsereItemEstac(int evento, int tempo, int numcliente, int tempochegada);
  44.     int NumLugarEstac(int n1);
  45.     friend void Simulacao(CNoFila &Actual, int &t, int n1, int &carrosout, int n2);
  46. };
  47.  
  48. class CFilaPrincipal{
  49.  
  50. public:
  51.     CNoFila *Inicio;
  52.     CNoFila *Fim;
  53.     void InsereNoPrincipal(int evento, int numcliente, int tempchegada);
  54.     friend void Simulacao(CNoFila &Actual, int &t, int n1, int &carrosout, int n2);
  55.  
  56.  
  57. };
  58.  
Class.cpp:

Expand|Select|Wrap|Line Numbers
  1. #include <iostream>
  2. #include "Class.h"
  3.  
  4. //CFilaLavagem
  5.  
  6. void CFilaLavagem::ApagaItemLav(int numcliente)
  7. {
  8.     CNoFila    *Actual = InicioLav;
  9.     CNoFila *Anterior;
  10.     if (InicioLav == NULL) return;
  11.  
  12.     else{
  13.         while(Actual!=NULL){
  14.             if(Actual->numcliente == numcliente){
  15.                 if(Anterior ==NULL){
  16.                     InicioLav = Actual->Proximo;
  17.                 }
  18.                 else{
  19.                     Anterior->Proximo = Actual->Proximo;
  20.                 }
  21.                 delete (Actual);
  22.                 return;
  23.             }
  24.             Anterior = Actual;
  25.             Actual=Actual->Proximo;
  26.         }
  27.         if (InicioLav ==NULL) FimLav = NULL;
  28.     }
  29.  
  30. }
  31. CFilaLavagem::CFilaLavagem(void)
  32. {
  33.  
  34.     InicioLav = FimLav = NULL;
  35.  
  36. }
  37.  
  38. CFilaLavagem::~CFilaLavagem(void)
  39. {
  40.  
  41.     delete this;
  42.  
  43. }
  44.  
  45.  
  46. int CFilaLavagem::lugareslavagem(void)
  47. {
  48.     int lavagem = 0;
  49.     CNoFila *Actual = InicioLav;
  50.  
  51.     if (Actual==NULL) return 0;
  52.     else{
  53.         while(Actual!=NULL)
  54.         {
  55.             lavagem++;
  56.             Actual = Actual->Proximo;
  57.         }
  58.     }
  59.     return (lavagem);
  60.  
  61. }
  62.  
  63.  
  64.  
  65.  
  66. void CFilaLavagem::EstacParaLavagem(CNoFila &L)
  67. {
  68.  
  69.     CNoFila *Novo = new CNoFila;
  70.  
  71.     Novo->evento = L.evento;
  72.     Novo->tempo = L.tempo;
  73.     Novo->tempochegada = L.tempochegada;
  74.     Novo->numcliente = L.numcliente;
  75.  
  76.     Novo->Proximo=NULL;
  77.     if( InicioLav == NULL ) InicioLav = Novo;  
  78.     else{
  79.         FimLav->Proximo = Novo; 
  80.     }
  81.  
  82.     FimLav = Novo;
  83.  
  84.  
  85. }
  86.  
  87. void CFilaLavagem::InsereItemLav(int evento, int tempo,int numcliente, int tempochegada)
  88. {
  89.  
  90.     CNoFila *Novo = new CNoFila;
  91.  
  92.     Novo->evento =evento;
  93.     Novo->tempo = tempo;
  94.     Novo->tempochegada = tempochegada;
  95.     Novo->numcliente = numcliente;
  96.     Novo->Proximo=NULL;
  97.     if( InicioLav == NULL ) InicioLav = Novo;  
  98.     else{
  99.         FimLav->Proximo = Novo; 
  100.     }
  101.  
  102.     FimLav = Novo;
  103. }
  104.  
  105. int NumLugarLav(int n1){
  106. int numlugar;
  107.  
  108. return numlugar;
  109. }
  110.  
  111. //CFilaEstacionamento
  112.  
  113. CFilaEstacionamento::~CFilaEstacionamento()
  114. {
  115.  
  116.     delete this;
  117.  
  118. }
  119.  
  120. CFilaEstacionamento::CFilaEstacionamento()
  121. {
  122.  
  123.     InicioEstac = FimEstac = NULL;
  124.  
  125. }
  126.  
  127. int CFilaEstacionamento::lugaresestacionamento(void)
  128. {
  129.     int estac = 0;
  130.     CNoFila *Actual = InicioEstac;
  131.  
  132.     if (Actual==NULL) return 0;
  133.     else{
  134.         while(Actual!=NULL)
  135.         {
  136.             estac++;
  137.             Actual = Actual->Proximo;
  138.         }
  139.     }
  140.     return (estac);
  141. }
  142.  
  143.  
  144.  
  145. void CFilaEstacionamento::InsereItemEstac(int evento, int tempo, int numcliente, int tempochegada) {
  146.  
  147.     CNoFila *Novo = new CNoFila;
  148.  
  149.     Novo->evento = evento;
  150.     Novo->tempo = tempo;
  151.     Novo->tempochegada = tempochegada;
  152.     Novo->numcliente = numcliente;
  153.     Novo->Proximo=NULL;
  154.     if( InicioEstac == NULL ) InicioEstac = Novo;  
  155.     else{
  156.         FimEstac->Proximo = Novo; 
  157.     }
  158.  
  159.     FimEstac = Novo;
  160. }
  161.  
  162. void CFilaEstacionamento::ApagaItemEstac(void)
  163. {
  164.     CNoFila *Aux;
  165.  
  166.     if (InicioEstac == NULL) return;
  167.  
  168.     else{
  169.  
  170.         Aux = InicioEstac;
  171.         InicioEstac = Aux->Proximo;
  172.         delete Aux;
  173.  
  174.         if (InicioEstac ==NULL) FimEstac = NULL;
  175.     }
  176.  
  177. }
  178.  
  179. int NumLugarEstac(int n1){
  180.     int numlugar;
  181.  
  182. return numlugar;
  183. }
  184.  
  185.  
  186. //CFilaPrincipal
  187.  
  188. void CFilaPrincipal::InsereNoPrincipal(int evento, int numcliente, int tempochegada){
  189.  
  190.  
  191.     CNoFila *Novo = new CNoFila;
  192.  
  193.     Novo->evento = evento;
  194.     Novo->tempochegada = tempochegada;
  195.     Novo->numcliente = numcliente;
  196.     Novo->Proximo=NULL;
  197.  
  198.     if( Inicio == NULL ) Inicio = Novo;  
  199.     else{
  200.         Fim->Proximo = Novo; 
  201.     }
  202.  
  203.     Fim = Novo;
  204. }
  205.  


main.cpp:

Expand|Select|Wrap|Line Numbers
  1. #include <iostream>
  2. #include "Class.h"
  3. #include <fstream>
  4. CFilaLavagem C1;
  5. CFilaEstacionamento C2;
  6. CFilaPrincipal C3;
  7.  
  8. using namespace std;
  9.  
  10.  
  11.  
  12. void Imprime(int numerocarro, int numlugar, int situacao, int tempo);
  13.  
  14.  
  15. void Simulacao(CNoFila &Actual, int &t, int n1, int &carrosout, int n2)
  16. {
  17.  
  18.     while( (Actual != NULL) && (t < n2)){
  19.  
  20.  
  21.         CNoFila *Aux;
  22.         cout << "Chegada de um carro";
  23.         for (int i = 0; i < Actual.tempochegada; i++){
  24.  
  25.         }
  26.  
  27.         t = t + Actual.tempochegada;
  28.         //falta determinar lugar memo
  29.         bool lugar = spot(n1, Actual.tempo, Actual.evento, carrosout, Actual.numcliente, Actual.numlugar, Actual.tempochegada);
  30.  
  31.         *Aux = Actual;
  32.  
  33.         if (lugar == 1){
  34.             for (int j = 0; j < Aux->tempo; j++){
  35.                 Actual = Actual.Proximo;
  36.  
  37.                 Simulacao(Actual, t, n1, carrosout, n2);
  38.  
  39.                 t +=Aux->tempo;
  40.             }
  41.         }
  42.     }
  43. }
  44.  
  45. bool spot(int n1, int tempo, int evento, int &carrosout, int numcliente, int numlugar, int tempochegada)
  46. {
  47.  
  48.  
  49.     CNoFila *Aux = C2.InicioEstac;
  50.  
  51.     int lugaresestac= 2 * (8-n1);
  52.     int lavagemocupado = C1.lugareslavagem();
  53.     int estacocupado = C2.lugaresestacionamento();
  54.  
  55.     if (lavagemocupado < n1){
  56.         if (estacocupado ==0){
  57.             C1.InsereItemLav(evento, tempo, numcliente, tempochegada);
  58.             Imprime(numcliente, numlugar, 0, tempo);
  59.             return 1;
  60.         }
  61.  
  62.         else {
  63.             C1.EstacParaLavagem(*C2.InicioEstac);
  64.             Imprime(Aux->numcliente, Aux->numlugar, 3, Aux->tempo);
  65.             C2.InsereItemEstac(evento, tempo, numcliente, tempochegada);
  66.             Imprime(numcliente, numlugar, 1, tempo);
  67.             return 0;
  68.         }
  69.     }
  70.  
  71.     if (lavagemocupado == n1){
  72.         if (estacocupado < lugaresestac){
  73.             C2.InsereItemEstac(evento, tempo, numcliente, tempochegada);
  74.             Imprime(numcliente, numlugar, 1, tempo);
  75.             return 0;
  76.         }
  77.  
  78.         else{
  79.             carrosout++;
  80.             Imprime(numcliente, numlugar, 2, tempo);
  81.             return 0;
  82.         }
  83.  
  84.  
  85.     }
  86.     return 0;
  87.  
  88. }
  89.  
  90.  
  91. void Imprime(int numerocarro, int numlugar, int situacao, int tempo){
  92.  
  93.     float hora = tempo/3600;
  94.     float minuto = (hora - (int)hora)*60;
  95.     float segundo = (minuto - (int)minuto)*60;
  96.  
  97.  
  98.  
  99.     ofstream fout;
  100.  
  101.     fout.open("Registo.txt");
  102.  
  103.     switch (situacao){
  104.     case 0: fout << hora << ":" << minuto << ":" << segundo << " - Chegada de um novo cliente (#" << numerocarro << "). Ocupa o lugar de lavagem #" << numlugar << ". Executa a opcao escolhida." << endl; 
  105.     break;
  106.     case 1: fout << hora << ":" << minuto << ":" << segundo << " - Chegada de um novo cliente (#" << numerocarro << "). Ocupa o lugar de estacionamento #" << numlugar << ". Aguarda a sua vez." << endl;
  107.     break;
  108.     case 2: fout << hora << ":" << minuto << ":" << segundo << " - Chegada de um novo cliente (#" << numerocarro << "). Os lugares estao todos ocupados e o carro vai-se embora" << endl;
  109.     break;
  110.     case 3: fout << hora << ":" << minuto << ":" << segundo << " - O cliente #" << numerocarro << " que se encontrava no estacionamento desloca-se para o lugar de lavagem #" << numlugar << endl; 
  111.     }
  112.  
  113.     fout.close();
  114.  
  115. }
  116.  
  117.  
  118.  
  119.  
  120. int TempoEvento(int evento, int n4, int m4, int n5, int m5, int n6, int m6){
  121.  
  122.     int tempototal;
  123.  
  124.     if (evento == 1){
  125.         tempototal = (rand()%(n4+m4+1)) + (n4-m4-2);
  126.     }
  127.  
  128.     if (evento == 2){
  129.         tempototal = ((rand()%(n5+m5+1)) + (n5-m5-2))+((rand()%(n4+m4+1)) + (n4-m4-2));
  130.     }
  131.  
  132.     if (evento == 3){
  133.         tempototal = ((rand()%(n6+m6+1)) + (n6-m6-2)) + ((rand()%(n5+m5+1)) + (n5-m5-2))+((rand()%(n4+m4+1)) + (n4-m4-2));
  134.     }
  135.  
  136.     return tempototal;
  137. }
  138.  
  139. int main()
  140. {
  141.     //DECLARAÇÃO
  142.  
  143.     CNoFila *Actual;
  144.  
  145.     int n3, m3, n4, m4, n5, m5, n6, m6;
  146.     int n1,n2, numtotalclientes, numcliente = 1;
  147.  
  148.     //=======================================================
  149.  
  150.     //VALORES PEDIDOS AO UTILIZADOR
  151.  
  152.     do{
  153.     cout << "Introduza o numero de zonas de lavagem a simular(1 a 8): ";
  154.     cin >> n1;
  155.     }while(1 > n1 && n1 > 8);
  156.  
  157.     do{
  158.     cout << "Introduza tempo TOTAL de simulacao: ";
  159.     cin >> n2;
  160.     }while(1 > n2);
  161.  
  162.     do{
  163.     cout << "Introduza valores de n3 e m3 (INTERVALO-chegada de novo cliente): ";
  164.     cout<< "n3:"; cin >> n3;
  165.     cout<< "m3:"; cin >> m3;
  166.     }while(1 > n3 && m3 < 1);
  167.  
  168.     do{
  169.     cout << "Introduza valores de n4 e m4 (INTERVALO-lavagem do carro): ";
  170.     cout<< "n4:"; cin >> n4;
  171.     cout<< "m4:"; cin >> m4;
  172.     }while(1 > n4 && m4 < 1);
  173.  
  174.     do{
  175.     cout << "Introduza valores de n5 e m5 (INTERVALO-aspiração do carro): ";
  176.     cout<< "n5:"; cin >> n5;
  177.     cout<< "m5:"; cin >> m5;
  178.     }while(1 > n5 && m5 < 1);
  179.  
  180.     do{
  181.     cout << "Introduza valores de n5 e m5 (INTERVALO-polimento do carro): ";
  182.     cout<< "n6:"; cin >> n6;
  183.     cout<< "m6:"; cin >> m6;
  184.     }while(1 > n6 && m6 < 1);
  185.  
  186.     cout << "\nO numero total de lugares de estacionamento e': " << 2 * (8-n1) << endl;
  187.  
  188.     cout << "Introduza o numero total de clientes do estabelecimento: ";
  189.     cin >> numtotalclientes;
  190.  
  191.     //===========================================================
  192.  
  193.     for( int i=0; i < numtotalclientes; i++){
  194.  
  195.         int evento = rand()% 2;
  196.         evento++;
  197.         int tempchegada = (rand()%(n3+m3+1)) + (n3-m3-2);
  198.         C3.InsereNoPrincipal(evento, numcliente, tempchegada);
  199.  
  200.  
  201.         numcliente++;
  202.     }
  203.  
  204.     //===========================================================
  205.  
  206.     for(int j = 0; j < numtotalclientes; j++){
  207.  
  208.         Actual = C3.Inicio;
  209.  
  210.         int t2 = TempoEvento(Actual->evento, n4, m4, n5, m5, n6, m6);
  211.  
  212.         Actual->tempo = t2;
  213.  
  214.         Actual = Actual->Proximo;
  215.     }
  216.  
  217.  
  218.     cout << "Comecando a Simulacao!" << endl;
  219.  
  220.     int t = 0;// memo
  221.  
  222.     return 0;
  223. }
  224.  
  225.  
  226.  
  227.  

these are the errors:

1>c:\users\tiago\documents\visual studio 2008\projects\projectoeda\projectoeda\main.cpp(18) : error C2784: 'bool std::operator !=(const std::istreambuf_iterator<_Elem,_Traits> &,const std::istreambuf_iterator<_Elem,_Traits> &)' : could not deduce template argument for 'const std::istreambuf_iterator<_Elem,_Traits> &' from 'CNoFila'
1> c:\program files (x86)\microsoft visual studio 9.0\vc\include\streambuf(557) : see declaration of 'std::operator !='
1>c:\users\tiago\documents\visual studio 2008\projects\projectoeda\projectoeda\main.cpp(18) : error C2784: 'bool std::operator !=(const std::allocator<_Ty> &,const std::allocator<_Other> &) throw()' : could not deduce template argument for 'const std::allocator<_Ty> &' from 'CNoFila'
1> c:\program files (x86)\microsoft visual studio 9.0\vc\include\xmemory(180) : see declaration of 'std::operator !='
1>c:\users\tiago\documents\visual studio 2008\projects\projectoeda\projectoeda\main.cpp(18) : error C2784: 'bool std::operator !=(const std::reverse_iterator<_RanIt> &,const std::reverse_iterator<_RanIt2> &)' : could not deduce template argument for 'const std::reverse_iterator<_RanIt> &' from 'CNoFila'
1> c:\program files (x86)\microsoft visual studio 9.0\vc\include\xutility(2254) : see declaration of 'std::operator !='
1>c:\users\tiago\documents\visual studio 2008\projects\projectoeda\projectoeda\main.cpp(18) : error C2784: 'bool std::operator !=(const std::_Revranit<_RanIt,_Base> &,const std::_Revranit<_RanIt2,_Base2> &)' : could not deduce template argument for 'const std::_Revranit<_RanIt,_Base> &' from 'CNoFila'
1> c:\program files (x86)\microsoft visual studio 9.0\vc\include\xutility(2061) : see declaration of 'std::operator !='
1>c:\users\tiago\documents\visual studio 2008\projects\projectoeda\projectoeda\main.cpp(18) : error C2784: 'bool std::operator !=(const std::pair<_Ty1,_Ty2> &,const std::pair<_Ty1,_Ty2> &)' : could not deduce template argument for 'const std::pair<_Ty1,_Ty2> &' from 'CNoFila'
1> c:\program files (x86)\microsoft visual studio 9.0\vc\include\utility(91) : see declaration of 'std::operator !='
1>c:\users\tiago\documents\visual studio 2008\projects\projectoeda\projectoeda\main.cpp(18) : error C2676: binary '!=' : 'CNoFila' does not define this operator or a conversion to a type acceptable to the predefined operator
1>c:\users\tiago\documents\visual studio 2008\projects\projectoeda\projectoeda\main.cpp(18) : fatal error C1903: unable to recover from previous error(s); stopping compilation


Can anyone help me fix this errors??

thanks for any help
Jul 8 '10 #1
8 1973
Oralloy
988 Expert 512MB
Line 18 is failing to compile because you're passing Actual to the method by reference, and not by address.

How do you intend the function Simulacao(...) to be used?
Jul 9 '10 #2
The function Simulation() should receive a pointer Actual to one member of a list and by recursion go through the entire list calling itself with Actual being the next member of the list using this line:
Actual = Actual.Proximo;

wich is like:
Actual = Actual.Next;

so when the function reaches the end of the list, it would stop, being the pointer Actual = NULL

PS:sword117 o problema tambem acho que esta na variavel mas nao estou a ver bem como passa la a funcao, pois estou acostumado a passar assim os nos, e respondi em ingles para todos perceberem :)
Jul 9 '10 #3
i was able to fix some errors.....

now there is only one and i don't get it.....

function Simulacao():

Expand|Select|Wrap|Line Numbers
  1. void Simulacao(CNoFila &L, int &t, int n1, int &carrosout, int n2)
  2. {
  3.     CNoFila *Actual;
  4.     Actual = &L;
  5.  
  6.     while( (Actual != NULL) && (t < n2)){
  7.  
  8.  
  9.         CNoFila *Aux;
  10.         cout << "Chegada de um carro";
  11.         for (int i = 0; i < Actual->tempochegada; i++){
  12.  
  13.         }
  14.  
  15.         t = t + Actual->tempochegada;
  16.         //falta determinar lugar memo
  17.         bool lugar = spot(n1, Actual->tempo, Actual->evento, carrosout, Actual->numcliente, Actual->numlugar, Actual->tempochegada);
  18.  
  19.         *Aux = Actual;
  20.  
  21.         if (lugar == 1){
  22.             for (int j = 0; j < Aux->tempo; j++){
  23.                 Actual = Actual->Proximo;
  24.  
  25.                 Simulacao(*Actual, t, n1, carrosout, n2);
  26.  
  27.                 t +=Aux->tempo;
  28.             }
  29.         }
  30.     }
  31. }
error:

1>c:\users\tiago\documents\visual studio 2008\projects\projectoeda\projectoeda\main.cpp(33) : error C2679: binary '=' : no operator found which takes a right-hand operand of type 'CNoFila *' (or there is no acceptable conversion)
1> c:\users\tiago\documents\visual studio 2008\projects\projectoeda\projectoeda\class.h(9): could be 'CNoFila &CNoFila::operator =(const CNoFila &)'
1> while trying to match the argument list '(CNoFila, CNoFila *)'
Jul 9 '10 #4
Banfa
9,065 Expert Mod 8TB
Line 19 of the posted listing. Aux and Actual have the same type, CNoFila * so there is no need to dereference Aux while assigning to it.
Jul 9 '10 #5
yeah that fixed it!!!

well e continued the solution and came across this errors....but i cant see how to solve....i get the errors(:S) but i'm kind of stuck here

Class.h:

Expand|Select|Wrap|Line Numbers
  1. class CNoFila{
  2.   public:
  3.     int evento;
  4.     int tempo;
  5.     int numcliente;
  6.     int numlugar;
  7.     int tempochegada;
  8.     CNoFila *Proximo;
  9. };
  10.  
  11.  
  12.  
  13. class CFilaLavagem{
  14.  
  15.   public:
  16.     CNoFila *InicioLav;
  17.     CNoFila *FimLav;
  18.     CFilaLavagem(void);                      //constructor por defeito
  19.     ~CFilaLavagem(void);                 //Destructor
  20.     friend class CFilaEstacionamento;
  21.     void ApagaItemLav(int numcliente);
  22.     int lugareslavagem(void);
  23.     friend bool spot(int n1, int tempo, int evento, int &carrosout, int numcliente, int numlugar, int tempochegada);
  24.     void EstacParaLavagem(CNoFila &L);
  25.     void InsereItemLav(int evento, int tempo, int numcliente, int tempochegada, int numlugar);
  26.     int NumLugarLav(int n1, CNoFila &L);
  27.     friend void Simulacao(CNoFila &L, int &t, int n1, int &carrosout, int n2);
  28. };
  29.  
  30.  
  31. class CFilaEstacionamento{
  32.  
  33.   public:
  34.     CNoFila *InicioEstac;
  35.     CNoFila *FimEstac;
  36.     CFilaEstacionamento();                      //constructor por defeito
  37.     CFilaEstacionamento(const CNoFila & L);
  38.     ~CFilaEstacionamento(void);                 //Destructor
  39.  
  40.     void ApagaItemEstac(void);
  41.     int lugaresestacionamento(void);
  42.     friend bool spot(int n1, int tempo, int evento, int &carrosout, int numcliente, int numlugar, int tempochegada);
  43.     friend class CFilaLavagem;
  44.     void InsereItemEstac(int evento, int tempo, int numcliente, int tempochegada, int numlugar);
  45.     int NumLugarEstac(int n1, CNoFila *InicioEstac);
  46.     friend void Simulacao(CNoFila &L, int &t, int n1, int &carrosout, int n2);
  47. };
  48.  
  49. class CFilaPrincipal{
  50.  
  51. public:
  52.     CNoFila *Inicio;
  53.     CNoFila *Fim;
  54.     void InsereNoPrincipal(int evento, int numcliente, int tempchegada);
  55.     friend void Simulacao(CNoFila &Actual, int &t, int n1, int &carrosout, int n2);
  56.  
  57.  
  58. };
Class.cpp:

Expand|Select|Wrap|Line Numbers
  1. #include <iostream>
  2. #include "Class.h"
  3.  
  4. //CFilaLavagem
  5.  
  6. void CFilaLavagem::ApagaItemLav(int numcliente)
  7. {
  8.     CNoFila    *Actual = InicioLav;
  9.     CNoFila *Anterior;
  10.     if (InicioLav == NULL) return;
  11.  
  12.     else{
  13.         while(Actual!=NULL){
  14.             if(Actual->numcliente == numcliente){
  15.                 if(Anterior ==NULL){
  16.                     InicioLav = Actual->Proximo;
  17.                 }
  18.                 else{
  19.                     Anterior->Proximo = Actual->Proximo;
  20.                 }
  21.                 delete (Actual);
  22.                 return;
  23.             }
  24.             Anterior = Actual;
  25.             Actual=Actual->Proximo;
  26.         }
  27.         if (InicioLav ==NULL) FimLav = NULL;
  28.     }
  29.  
  30. }
  31. CFilaLavagem::CFilaLavagem(void)
  32. {
  33.  
  34.     InicioLav = FimLav = NULL;
  35.  
  36. }
  37.  
  38. CFilaLavagem::~CFilaLavagem(void)
  39. {
  40.  
  41.     delete this;
  42.  
  43. }
  44.  
  45.  
  46. int CFilaLavagem::lugareslavagem(void)
  47. {
  48.     int lavagem = 0;
  49.     CNoFila *Actual = InicioLav;
  50.  
  51.     if (Actual==NULL) return 0;
  52.     else{
  53.         while(Actual!=NULL)
  54.         {
  55.             lavagem++;
  56.             Actual = Actual->Proximo;
  57.         }
  58.     }
  59.     return (lavagem);
  60.  
  61. }
  62.  
  63.  
  64.  
  65.  
  66. void CFilaLavagem::EstacParaLavagem(CNoFila &L)
  67. {
  68.  
  69.     CNoFila *Novo = new CNoFila;
  70.  
  71.     Novo->evento = L.evento;
  72.     Novo->tempo = L.tempo;
  73.     Novo->tempochegada = L.tempochegada;
  74.     Novo->numcliente = L.numcliente;
  75.     Novo->numlugar = L.numlugar;
  76.  
  77.     Novo->Proximo=NULL;
  78.     if( InicioLav == NULL ) InicioLav = Novo;  
  79.     else{
  80.         FimLav->Proximo = Novo; 
  81.     }
  82.  
  83.     FimLav = Novo;
  84.  
  85.  
  86. }
  87.  
  88. void CFilaLavagem::InsereItemLav(int evento, int tempo,int numcliente, int tempochegada, int numlugar)
  89. {
  90.  
  91.     CNoFila *Novo = new CNoFila;
  92.  
  93.     Novo->evento =evento;
  94.     Novo->tempo = tempo;
  95.     Novo->tempochegada = tempochegada;
  96.     Novo->numcliente = numcliente;
  97.     Novo->numlugar = numlugar;
  98.     Novo->Proximo=NULL;
  99.     if( InicioLav == NULL ) InicioLav = Novo;  
  100.     else{
  101.         FimLav->Proximo = Novo; 
  102.     }
  103.  
  104.     FimLav = Novo;
  105. }
  106.  
  107. int NumLugarLav(int n1, CNoFila &L){
  108.  
  109.  
  110.     int tabaux[8];
  111.     CNoFila *Actual;
  112.     Actual = &L;
  113.     int lugar;
  114.  
  115.     for (int i = 0; i < n1; i++){
  116.  
  117.         tabaux[i] = Actual->numlugar;
  118.         Actual = Actual->Proximo;
  119.     }
  120.  
  121.     for (int i = 0; i < n1; i++){
  122.  
  123.         if(tabaux[i]==1) continue;
  124.         else { 
  125.             lugar=1;
  126.             break;
  127.         } 
  128.  
  129.         if(tabaux[i]==2) continue;
  130.         else { 
  131.             lugar=2;
  132.             break;
  133.         }
  134.  
  135.         if(tabaux[i]==3) continue;
  136.         else { 
  137.             lugar=3;
  138.             break;
  139.         }
  140.  
  141.         if(tabaux[i]==4) continue;
  142.         else { 
  143.             lugar=4;
  144.             break;
  145.         }
  146.  
  147.         if(tabaux[i]==5) continue;
  148.         else { 
  149.             lugar=5;
  150.             break;
  151.         }
  152.  
  153.         if(tabaux[i]==6) continue;
  154.         else { 
  155.             lugar=6;
  156.             break;
  157.         }
  158.  
  159.         if(tabaux[i]==7) continue;
  160.         else { 
  161.             lugar=7;
  162.             break;
  163.         }
  164.  
  165.         if(tabaux[i]==8) continue;
  166.         else { 
  167.             lugar=8;
  168.             break;
  169.         }
  170.     }
  171.     return lugar;
  172.  
  173. }
  174.  
  175. //CFilaEstacionamento
  176.  
  177. CFilaEstacionamento::~CFilaEstacionamento()
  178. {
  179.  
  180.     delete this;
  181.  
  182. }
  183.  
  184. CFilaEstacionamento::CFilaEstacionamento()
  185. {
  186.  
  187.     InicioEstac = FimEstac = NULL;
  188.  
  189. }
  190.  
  191. int CFilaEstacionamento::lugaresestacionamento(void)
  192. {
  193.     int estac = 0;
  194.     CNoFila *Actual = InicioEstac;
  195.  
  196.     if (Actual==NULL) return 0;
  197.     else{
  198.         while(Actual!=NULL)
  199.         {
  200.             estac++;
  201.             Actual = Actual->Proximo;
  202.         }
  203.     }
  204.     return (estac);
  205. }
  206.  
  207.  
  208.  
  209. void CFilaEstacionamento::InsereItemEstac(int evento, int tempo, int numcliente, int tempochegada, int numlugar) {
  210.  
  211.     CNoFila *Novo = new CNoFila;
  212.  
  213.     Novo->evento = evento;
  214.     Novo->tempo = tempo;
  215.     Novo->tempochegada = tempochegada;
  216.     Novo->numcliente = numcliente;
  217.     Novo->numlugar = numlugar;
  218.     Novo->Proximo=NULL;
  219.     if( InicioEstac == NULL ) InicioEstac = Novo;  
  220.     else{
  221.         FimEstac->Proximo = Novo; 
  222.     }
  223.  
  224.     FimEstac = Novo;
  225. }
  226.  
  227. void CFilaEstacionamento::ApagaItemEstac(void)
  228. {
  229.     CNoFila *Aux;
  230.  
  231.     if (InicioEstac == NULL) return;
  232.  
  233.     else{
  234.  
  235.         Aux = InicioEstac;
  236.         InicioEstac = Aux->Proximo;
  237.         delete Aux;
  238.  
  239.         if (InicioEstac ==NULL) FimEstac = NULL;
  240.     }
  241.  
  242. }
  243.  
  244. int NumLugarEstac(int n1,CNoFila *InicioEstac){
  245.  
  246.     int tabaux[14];
  247.  
  248.  
  249.     CNoFila *Actual;
  250.     Actual = InicioEstac;
  251.  
  252.     for (int i = 0; i < 2 * (8-n1); i++){
  253.  
  254.         tabaux[i] = Actual->numlugar;
  255.         Actual = Actual->Proximo;
  256.     }
  257.  
  258.     for (int i = 0; i < 2 * (8-n1); i++){
  259.  
  260.         if(tabaux[i]!=1) return 1;
  261.         else { 
  262.  
  263.             if(tabaux[i]!=2) return 2;
  264.             else { 
  265.  
  266.                 if(tabaux[i]!=3) return 3;
  267.                 else { 
  268.  
  269.  
  270.                     if(tabaux[i]!=4) return 4;
  271.                     else { 
  272.  
  273.                         if(tabaux[i]!=5) return 5;
  274.                         else { 
  275.  
  276.  
  277.                             if(tabaux[i]!=6) return 6;
  278.                             else { 
  279.  
  280.  
  281.                                 if(tabaux[i]!=7) return 7;
  282.                                 else { 
  283.  
  284.  
  285.                                     if(tabaux[i]!=8) return 8;
  286.                                     else { 
  287.  
  288.                                         if(tabaux[i]!=9) return 9;
  289.                                         else { 
  290.  
  291.                                             if(tabaux[i]!=10) return 10;
  292.                                             else { 
  293.  
  294.                                                 if(tabaux[i]!=11) return 11;
  295.                                                 else { 
  296.  
  297.                                                     if(tabaux[i]!=12) return 12;
  298.                                                     else { 
  299.  
  300.                                                         if(tabaux[i]!=13) return 13;
  301.                                                         else { 
  302.  
  303.                                                                 if(tabaux[i]!=14) return 14;
  304.                                                         }
  305.                                                     }
  306.                                                 }
  307.                                             }
  308.                                         }
  309.                                     }
  310.                                 }
  311.                             }
  312.                         }
  313.                     }
  314.                 }
  315.             }
  316.         }
  317.  
  318.  
  319.     }
  320.  
  321.  
  322. }
  323.  
  324. //CFilaPrincipal
  325.  
  326. void CFilaPrincipal::InsereNoPrincipal(int evento, int numcliente, int tempochegada){
  327.  
  328.  
  329.     CNoFila *Novo = new CNoFila;
  330.  
  331.     Novo->evento = evento;
  332.     Novo->tempochegada = tempochegada;
  333.     Novo->numcliente = numcliente;
  334.     Novo->Proximo=NULL;
  335.  
  336.     if( Inicio == NULL ) Inicio = Novo;  
  337.     else{
  338.         Fim->Proximo = Novo; 
  339.     }
  340.  
  341.     Fim = Novo;
  342. }

main.cpp:

Expand|Select|Wrap|Line Numbers
  1. #include <iostream>
  2. #include "Class.h"
  3. #include <fstream>
  4. CFilaLavagem C1;
  5. CFilaEstacionamento C2;
  6. CFilaPrincipal C3;
  7.  
  8. using namespace std;
  9.  
  10.  
  11.  
  12. void Imprime(int numerocarro, int numlugar, int situacao, int tempo);
  13.  
  14.  
  15. void Simulacao(CNoFila &L, int &t, int n1, int &carrosout, int n2)
  16. {
  17.     CNoFila *Actual;
  18.     Actual = &L;
  19.  
  20.     while( (Actual != NULL) && (t < n2)){
  21.  
  22.  
  23.         CNoFila *Aux;
  24.         cout << "Chegada de um carro";
  25.         for (int i = 0; i < Actual->tempochegada; i++){
  26.  
  27.         }
  28.  
  29.         t = t + Actual->tempochegada;
  30.         //falta determinar lugar memo
  31.         bool lugar = spot(n1, Actual->tempo, Actual->evento, carrosout, Actual->numcliente, Actual->numlugar, Actual->tempochegada);
  32.  
  33.         Aux = Actual;
  34.  
  35.         if (lugar == 1){
  36.             for (int j = 0; j < Aux->tempo; j++){
  37.                 Actual = Actual->Proximo;
  38.  
  39.                 Simulacao(*Actual, t, n1, carrosout, n2);
  40.  
  41.                 t +=Aux->tempo;
  42.             }
  43.         }
  44.     }
  45. }
  46.  
  47. bool spot(int n1, int tempo, int evento, int &carrosout, int numcliente, int tempochegada)
  48. {
  49.  
  50.  
  51.     CNoFila *Aux = C2.InicioEstac;
  52.     int numlugar1, numlugar2;
  53.     int lugaresestac= (2 * (8-n1));
  54.     int lavagemocupado = C1.lugareslavagem();
  55.     int estacocupado = C2.lugaresestacionamento();
  56.  
  57.  
  58.     if (lavagemocupado == 0){
  59.         numlugar1 = 1;
  60.         C1.InsereItemLav(evento, tempo, numcliente, tempochegada, numlugar1);
  61.     }
  62.     if ((lavagemocupado < n1) && (lavagemocupado > 0)){
  63.         if (estacocupado ==0){
  64.             numlugar1 = C1.NumLugarLav(n1,*C1.InicioLav);
  65.             C1.InsereItemLav(evento, tempo, numcliente, tempochegada, numlugar1);
  66.  
  67.             Imprime(numcliente, numlugar1, 0, tempo);
  68.             return 1;
  69.         }
  70.  
  71.         else {
  72.             C1.EstacParaLavagem(*C2.InicioEstac);
  73.             numlugar2 = C2.NumLugarEstac(n1,*C2.InicioEstac);
  74.             numlugar1 = C1.NumLugarLav(n1,*C1.InicioLav);
  75.             Imprime(Aux->numcliente, Aux->numlugar, 3, Aux->tempo);
  76.  
  77.             C2.InsereItemEstac(evento, tempo, numcliente, tempochegada, numlugar2);
  78.             Imprime(numcliente, numlugar2, 1, tempo);
  79.             return 0;
  80.         }
  81.     }
  82.  
  83.     if (lavagemocupado == n1){
  84.         if (estacocupado < lugaresestac){
  85.             numlugar2 = C2.NumLugarEstac(n1,*C2.InicioEstac);
  86.             C2.InsereItemEstac(evento, tempo, numcliente, tempochegada, numlugar2);
  87.             Imprime(numcliente, numlugar2, 1, tempo);
  88.             return 0;
  89.         }
  90.  
  91.         else{
  92.             carrosout++;
  93.             int numlugar = 0;
  94.             Imprime(numcliente, numlugar, 2, tempo);
  95.             return 0;
  96.         }
  97.  
  98.  
  99.     }
  100.     return 0;
  101.  
  102. }
  103.  
  104.  
  105. void Imprime(int numerocarro, int numlugar, int situacao, int tempo){
  106.  
  107.     float hora = tempo/3600;
  108.     float minuto = (hora - (int)hora)*60;
  109.     float segundo = (minuto - (int)minuto)*60;
  110.  
  111.  
  112.  
  113.     ofstream fout;
  114.  
  115.     fout.open("Registo.txt");
  116.  
  117.     switch (situacao){
  118.     case 0: fout << hora << ":" << minuto << ":" << segundo << " - Chegada de um novo cliente (#" << numerocarro << "). Ocupa o lugar de lavagem #" << numlugar << ". Executa a opcao escolhida." << endl; 
  119.     break;
  120.     case 1: fout << hora << ":" << minuto << ":" << segundo << " - Chegada de um novo cliente (#" << numerocarro << "). Ocupa o lugar de estacionamento #" << numlugar << ". Aguarda a sua vez." << endl;
  121.     break;
  122.     case 2: fout << hora << ":" << minuto << ":" << segundo << " - Chegada de um novo cliente (#" << numerocarro << "). Os lugares estao todos ocupados e o carro vai-se embora" << endl;
  123.     break;
  124.     case 3: fout << hora << ":" << minuto << ":" << segundo << " - O cliente #" << numerocarro << " que se encontrava no estacionamento desloca-se para o lugar de lavagem #" << numlugar << endl; 
  125.     }
  126.  
  127.     fout.close();
  128.  
  129. }
  130.  
  131.  
  132.  
  133.  
  134. int TempoEvento(int evento, int n4, int m4, int n5, int m5, int n6, int m6){
  135.  
  136.     int tempototal;
  137.  
  138.     if (evento == 1){
  139.         tempototal = (rand()%(n4+m4+1)) + (n4-m4-2);
  140.     }
  141.  
  142.     if (evento == 2){
  143.         tempototal = ((rand()%(n5+m5+1)) + (n5-m5-2))+((rand()%(n4+m4+1)) + (n4-m4-2));
  144.     }
  145.  
  146.     if (evento == 3){
  147.         tempototal = ((rand()%(n6+m6+1)) + (n6-m6-2)) + ((rand()%(n5+m5+1)) + (n5-m5-2))+((rand()%(n4+m4+1)) + (n4-m4-2));
  148.     }
  149.  
  150.     return tempototal;
  151. }
  152.  
  153. int main()
  154. {
  155.     //DECLARAÇÃO
  156.  
  157.     CNoFila *Actual;
  158.  
  159.     int n3, m3, n4, m4, n5, m5, n6, m6;
  160.     int n1,n2, numtotalclientes, numcliente = 1;
  161.  
  162.     //=======================================================
  163.  
  164.     //VALORES PEDIDOS AO UTILIZADOR
  165.  
  166.     do{
  167.     cout << "Introduza o numero de zonas de lavagem a simular(1 a 8): ";
  168.     cin >> n1;
  169.     }while(1 > n1 && n1 > 8);
  170.  
  171.     do{
  172.     cout << "Introduza tempo TOTAL de simulacao: ";
  173.     cin >> n2;
  174.     }while(1 > n2);
  175.  
  176.     do{
  177.     cout << "Introduza valores de n3 e m3 (INTERVALO-chegada de novo cliente): ";
  178.     cout<< "n3:"; cin >> n3;
  179.     cout<< "m3:"; cin >> m3;
  180.     }while(1 > n3 && m3 < 1);
  181.  
  182.     do{
  183.     cout << "Introduza valores de n4 e m4 (INTERVALO-lavagem do carro): ";
  184.     cout<< "n4:"; cin >> n4;
  185.     cout<< "m4:"; cin >> m4;
  186.     }while(1 > n4 && m4 < 1);
  187.  
  188.     do{
  189.     cout << "Introduza valores de n5 e m5 (INTERVALO-aspiração do carro): ";
  190.     cout<< "n5:"; cin >> n5;
  191.     cout<< "m5:"; cin >> m5;
  192.     }while(1 > n5 && m5 < 1);
  193.  
  194.     do{
  195.     cout << "Introduza valores de n5 e m5 (INTERVALO-polimento do carro): ";
  196.     cout<< "n6:"; cin >> n6;
  197.     cout<< "m6:"; cin >> m6;
  198.     }while(1 > n6 && m6 < 1);
  199.  
  200.     cout << "\nO numero total de lugares de estacionamento e': " << 2 * (8-n1) << endl;
  201.  
  202.     cout << "Introduza o numero total de clientes do estabelecimento: ";
  203.     cin >> numtotalclientes;
  204.  
  205.     //===========================================================
  206.  
  207.     for( int i=0; i < numtotalclientes; i++){
  208.  
  209.         int evento = rand()% 2;
  210.         evento++;
  211.         int tempchegada = (rand()%(n3+m3+1)) + (n3-m3-2);
  212.         C3.InsereNoPrincipal(evento, numcliente, tempchegada);
  213.  
  214.  
  215.         numcliente++;
  216.     }
  217.  
  218.     //===========================================================
  219.  
  220.     for(int j = 0; j < numtotalclientes; j++){
  221.  
  222.         Actual = C3.Inicio;
  223.  
  224.         int t2 = TempoEvento(Actual->evento, n4, m4, n5, m5, n6, m6);
  225.  
  226.         Actual->tempo = t2;
  227.  
  228.         Actual = Actual->Proximo;
  229.     }
  230.  
  231.  
  232.     cout << "Comecando a Simulacao!" << endl;
  233.  
  234.     int t = 0;// memo
  235.     int carrosout;
  236.     Simulacao(*C3.Inicio, t, n1, carrosout, n2);
  237.  
  238.     cout << "\nO numero de carros que abandonaram sem executar qualquer accao foi: " << carrosout << endl; 
  239.  
  240.  
  241.  
  242.     return 0;
  243. }

errors:

1>c:\users\tiago\documents\visual studio 2008\projects\projectoeda\projectoeda\main.cpp(73) : error C2664: 'CFilaEstacionamento::NumLugarEstac' : cannot convert parameter 2 from 'CNoFila' to 'CNoFila *'
1> No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
1>c:\users\tiago\documents\visual studio 2008\projects\projectoeda\projectoeda\main.cpp(85) : error C2664: 'CFilaEstacionamento::NumLugarEstac' : cannot convert parameter 2 from 'CNoFila' to 'CNoFila *'
1> No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called

can you help me?
Jul 10 '10 #6
newb16
687 512MB
int NumLugarEstac(int n1, CNoFila *InicioEstac);
The second parameter
*C2.InicioEstac is dereferenced type CNoFila*
that is CNoFila& . And there is no conversion from CNoFila& to CNoFila*.
Jul 10 '10 #7
ok that fixed that error but now its in the linking that there is an error not in compile:

1>Linking...
1>main.obj : error LNK2019: unresolved external symbol "bool __cdecl spot(int,int,int,int &,int,int,int)" (?spot@@YA_NHHHAAHHHH@Z) referenced in function "void __cdecl Simulacao(class CNoFila &,int &,int,int &,int)" (?Simulacao@@YAXAAVCNoFila@@AAHH1H@Z)
1>main.obj : error LNK2019: unresolved external symbol "public: int __thiscall CFilaEstacionamento::NumLugarEstac(int,class CNoFila &)" (?NumLugarEstac@CFilaEstacionamento@@QAEHHAAVCNoFi la@@@Z) referenced in function "bool __cdecl spot(int,int,int,int &,int,int)" (?spot@@YA_NHHHAAHHH@Z)
1>main.obj : error LNK2019: unresolved external symbol "public: int __thiscall CFilaLavagem::NumLugarLav(int,class CNoFila &)" (?NumLugarLav@CFilaLavagem@@QAEHHAAVCNoFila@@@Z) referenced in function "bool __cdecl spot(int,int,int,int &,int,int)" (?spot@@YA_NHHHAAHHH@Z)
1>C:\Users\Tiago\Documents\Visual Studio 2008\Projects\projectoeda\Debug\projectoeda.exe : fatal error LNK1120: 3 unresolved externals


from the previous post i only changed funcionts NumLugarEstac and NumLugarLav

NumLugarEstac:

numlugar2 = C2.NumLugarEstac(n1,*C2.InicioEstac);//calling function

Expand|Select|Wrap|Line Numbers
  1. int NumLugarEstac(int n1,CNoFila &InicioEstac){
  2.  
  3.     int tabaux[14];
  4.  
  5.  
  6.     CNoFila *Actual;
  7.     Actual = &InicioEstac;
  8.  
  9.     for (int i = 0; i < 2 * (8-n1); i++){
  10.  
  11.         tabaux[i] = Actual->numlugar;
  12.         Actual = Actual->Proximo;
  13.     }
(...)

NumLugarLav:

numlugar1 = C1.NumLugarLav(n1,*C1.InicioLav);//calling function...

Expand|Select|Wrap|Line Numbers
  1. int NumLugarLav(int n1, CNoFila &L){
  2.  
  3.  
  4.     int tabaux[8];
  5.     CNoFila *Actual;
  6.     *Actual = L;
  7.     int lugar;
  8.  
  9.     for (int i = 0; i < n1; i++){
  10.  
  11.         tabaux[i] = Actual->numlugar;
  12.         Actual = Actual->Proximo;
  13.     }
  14.  

these errors are from different symbols...in both functions declaration and implementation are exactly the same!

:S
Jul 10 '10 #8
Oralloy
988 Expert 512MB
Your first problem is between your declaration and definition of the function spot(...).

"spot()" is declared as bool spot(int,int,int,int &,int,int,int)

"spot()" is defined as bool spot(int,int,int,int &,int,int)

After that, there's a problem, as method CFilaEstacionamento::NumLugarEstac(int,class CNoFila &) is not defined in your source code.
Jul 12 '10 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Rakesh | last post by:
In my Python code fragment, I want to write a code fragment such that the minimum element of a tuple is subtracted from all the elements of a given tuple. When I execute the following python...
1
by: Ghost | last post by:
Hi all, I wrote a program in C# and now I have to "translate" it i visual C++ (MFC) using .NET, but I had a little problem: *ERRORS* error C3181: 'CTestDlg' : invalid operand for __typeof,...
5
by: Arpan | last post by:
I am trying to make a calculator in ASP.NET using VB.NET but certain errors are cropping up. This is a part of the code (please note that the code lines that are bold & in red colour generate the...
6
by: BlueTrin | last post by:
Hello I was adapting a C version of SolvOpt in C++ to use it within a virtual class. However I am stuck with the overriding of evaluation and gradiant functions. cStepCurveEvaluator.cpp...
66
by: Johan Tibell | last post by:
I've written a piece of code that uses sockets a lot (I know that sockets aren't portable C, this is not a question about sockets per se). Much of my code ended up looking like this: if...
19
by: Rajesh S R | last post by:
Consider the following code: int main() { struct name { long a; int b; long c; }s={3,4,5},*p; p=&s;
1
by: siresoth666 | last post by:
Greeting to everyone, I am a rookie at ASP and this may seem like a very simpleton question to most but I am clueless about it. I copied a code from a tutorial on to Flash its ASP but it does not...
7
by: somenath | last post by:
Hi All, I am trying to undestand "Type Conversions" from K&R book.I am not able to understand the bellow mentioned text "Conversion rules are more complicated when unsigned operands are...
4
by: chetoos | last post by:
#include <iostream.h> #include <string> using namespace std; void output_data(struct database*data_ptr); void input_data(struct database*data_ptr); struct database { int id_number; int age;...
3
by: StrugglingStudent | last post by:
I'm having problems finishing my program, it keeps giving me the error '=':function as left operand. And im not sure what that means. It is supposed to be a function to calculate basic car rental...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.