Hi, i'm a little bit new in programming, and i had an error in this following dev-c++ code:
(don't worry if you don't understand everything, it's in spanish)
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <strings.h>
#include <string>
using namespace std;
class shop
{
public:
int size;
string chooseTV;
float tvPrice;
int buyTV()
{
shop *pSize;
shop futureTV;
string prod = "x x x x x";
char* pTC;
char* pTE;
pTC = new char [prod.size()+1];
strcpy (pTC, prod.c_str());
cout << "Eliga una de estas 5 marcas que le ofrecemos: \n";
for (int i = 0; i < 5; i++)
{
cout << prod << endl;
}
cin >> futureTV.chooseTV;
pTE = new char [futureTV.chooseTV.size()+1];
strcpy (pTE, futureTV.chooseTV.c_str());
cout << "Ahora por favor inserte las pulgadas de su televisor\n";
cin >> futureTV.size;
pSize = &futureTV;
futureTV.tvPrice = 100;
for (int i = 0; i < 6; i++)
{
if (i == 0 && strncmp(pTE, strtok(pTC, " "), 9))
{
break;
}
else if (strnicmp (NULL, strtok(pTC, " "), 9) = 0) //here is the error.
{
break;
}
futureTV.tvPrice += 100;
if (i == 5)
{
cout << "La marca " << pTE << " no esta habilitado en este mercado\n";
cout << "Haga de vuelta los tramites\n";
buyTV();
}
}
if (pSize->size <= 5)
{
futureTV.tvPrice += 50;
}
else if (pSize->size <= 10 && pSize->size > 5)
{
futureTV.tvPrice += 100;
}
else if (pSize->size <= 20 && pSize->size > 10)
{
futureTV.tvPrice += 300;
}
else if (pSize->size <= 30 && pSize->size > 20)
{
futureTV.tvPrice += 500;
}
else if (pSize->size <= 35 && pSize->size > 30)
{
futureTV.tvPrice += 2000;
}
else if (pSize->size <= 45 && pSize->size > 35)
{
futureTV.tvPrice += 5000;
}
else if (pSize->size <= 55 && pSize->size > 45)
{
futureTV.tvPrice += 10000;
}
else
{
futureTV.tvPrice += 20000;
}
delete [] pTE;
delete [] pTC;
}
};
class television
{
public:
int channels [];
string channelCable[];
string channelName[20];
};
int main (int argn,char* pArg[])
{
}
can anybody tell me what happens here? thank you.
(don't worry if you don't understand everything, it's in spanish)
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <strings.h>
#include <string>
using namespace std;
class shop
{
public:
int size;
string chooseTV;
float tvPrice;
int buyTV()
{
shop *pSize;
shop futureTV;
string prod = "x x x x x";
char* pTC;
char* pTE;
pTC = new char [prod.size()+1];
strcpy (pTC, prod.c_str());
cout << "Eliga una de estas 5 marcas que le ofrecemos: \n";
for (int i = 0; i < 5; i++)
{
cout << prod << endl;
}
cin >> futureTV.chooseTV;
pTE = new char [futureTV.chooseTV.size()+1];
strcpy (pTE, futureTV.chooseTV.c_str());
cout << "Ahora por favor inserte las pulgadas de su televisor\n";
cin >> futureTV.size;
pSize = &futureTV;
futureTV.tvPrice = 100;
for (int i = 0; i < 6; i++)
{
if (i == 0 && strncmp(pTE, strtok(pTC, " "), 9))
{
break;
}
else if (strnicmp (NULL, strtok(pTC, " "), 9) = 0) //here is the error.
{
break;
}
futureTV.tvPrice += 100;
if (i == 5)
{
cout << "La marca " << pTE << " no esta habilitado en este mercado\n";
cout << "Haga de vuelta los tramites\n";
buyTV();
}
}
if (pSize->size <= 5)
{
futureTV.tvPrice += 50;
}
else if (pSize->size <= 10 && pSize->size > 5)
{
futureTV.tvPrice += 100;
}
else if (pSize->size <= 20 && pSize->size > 10)
{
futureTV.tvPrice += 300;
}
else if (pSize->size <= 30 && pSize->size > 20)
{
futureTV.tvPrice += 500;
}
else if (pSize->size <= 35 && pSize->size > 30)
{
futureTV.tvPrice += 2000;
}
else if (pSize->size <= 45 && pSize->size > 35)
{
futureTV.tvPrice += 5000;
}
else if (pSize->size <= 55 && pSize->size > 45)
{
futureTV.tvPrice += 10000;
}
else
{
futureTV.tvPrice += 20000;
}
delete [] pTE;
delete [] pTC;
}
};
class television
{
public:
int channels [];
string channelCable[];
string channelName[20];
};
int main (int argn,char* pArg[])
{
}
can anybody tell me what happens here? thank you.