NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

#ifndef _MAIN
#define _MAIN

#include <iostream>
#include "biblioteca/funciones/strings.hpp"
#include "biblioteca/funciones/tokens.hpp"
#include "biblioteca/funciones/files.hpp"
#include "biblioteca/tads/Array.hpp"
#include "biblioteca/tads/Map.hpp"
#include "biblioteca/tads/List.hpp"
#include "biblioteca/tads/Stack.hpp"
#include "biblioteca/tads/Queue.hpp"
#include "biblioteca/tads/Coll.hpp"
#include "principa.hpp"
using namespace std;

Coll<RProducto> subirProductos()
{
return {};
}
Coll<Rubro> subirRubros()
{
return {};
}

int leerCliente()
{
return 0;
}

Par leerPar()
{
return {};
}

void procesarParPunto1(Par par,Coll<RProducto>& ticket,Coll<RProducto> cPro)
{

}


void resultadosPunto1(Coll<RProducto> ticket,Coll<Rubro> cRub)
{
}

void procesarParPunto2(Par par,Coll<RProducto>& cPro)
{
}

void resultadosPunto2(Coll<RProducto> cPro)
{
}

int main()
{
Coll<RProducto> cPro = subirProductos();
Coll<Rubro> cRub = subirRubros();

int idCli = leerCliente();
while( idCli!=0 )
{
Coll<RProducto> ticket = coll<RProducto>();

Par par = leerPar();
while( par.idProd!=0 )
{
// proceso
procesarParPunto1(par,ticket,cPro);
procesarParPunto2(par,cPro);

par = leerPar();
}

// resultados
resultadosPunto1(ticket,cRub);
resultadosPunto2(cPro);

idCli = leerCliente();
}

return 0;
}

#endif



///////////////////////////////////////////////////////////////

#ifndef _MAINHPP
#define _MAINHPP
#include <iostream>
#include <iostream>
#include <sstream>
#include <string>
#include <string.h>
#include <stdlib.h>
#include "biblioteca/funciones/strings.hpp"
#include "biblioteca/funciones/tokens.hpp"
#include "biblioteca/tads/Coll.hpp"
using namespace std;

struct Producto
{
int idProd;
char descr[20];
double precio;
int idRub;
};

struct RProducto
{
Producto p;
int acum;
};

struct Rubro
{
int idRub;
char descr[20];
double promo;
};

struct RRubro
{
Rubro r;
double acum;
};

struct Par
{
int idProd;
int cant;
};

string productoToString(Producto x)
{
char sep = 1;
string sIdProd=to_string(x.idProd);
string sDescr=x.descr;
string sPrecio=to_string(x.precio);
string sIdRub=to_string(x.idRub);
return sIdProd+sep+sDescr+sep+sPrecio+sep+sIdRub;
}

Producto productoFromString(string s)
{
char sep = 1;
Producto x;
string t0 = getTokenAt(s,sep,0);
x.idProd=stoi(t0);
string t1 = getTokenAt(s,sep,1);
strcpy(x.descr,t1.c_str());
string t2 = getTokenAt(s,sep,2);
x.precio=stod(t2);
string t3 = getTokenAt(s,sep,3);
x.idRub=stoi(t3);
return x;
}

string productoToDebug(Producto x)
{
stringstream sout;
sout<< "[";
sout << x.idProd;
sout << ",";
sout << x.descr;
sout << ",";
sout << x.precio;
sout << ",";
sout << x.idRub;
sout<< "]";
return sout.str();
}

string productoToDebug(string mssg,Producto x)
{
stringstream sout;
sout<< mssg<<":[";
sout << x.idProd;
sout << ",";
sout << x.descr;
sout << ",";
sout << x.precio;
sout << ",";
sout << x.idRub;
sout<< "]";
return sout.str();
}

Producto producto(int idProd,string descr,double precio,int idRub)
{
Producto a;
a.idProd = idProd;
strcpy(a.descr,descr.c_str());
a.precio = precio;
a.idRub = idRub;
return a;
}

bool productoEquals(Producto a,Producto b)
{
if(a.idProd!=b.idProd) return false;
if(a.precio!=b.precio) return false;
if(a.idRub!=b.idRub) return false;
return true;
}

string rProductoToString(RProducto x)
{
char sep = 2;
string sP=productoToString(x.p);
string sAcum=to_string(x.acum);
return sP+sep+sAcum;
}

RProducto rProductoFromString(string s)
{
char sep = 2;
RProducto x;
string t0 = getTokenAt(s,sep,0);
x.p=productoFromString(t0);
string t1 = getTokenAt(s,sep,1);
x.acum=stoi(t1);
return x;
}

string rProductoToDebug(RProducto x)
{
stringstream sout;
sout<< "[";
sout << productoToDebug(x.p);
sout << ",";
sout << x.acum;
sout<< "]";
return sout.str();
}

string rProductoToDebug(string mssg,RProducto x)
{
stringstream sout;
sout<< mssg<<":[";
sout << productoToDebug(x.p);
sout << ",";
sout << x.acum;
sout<< "]";
return sout.str();
}

RProducto rProducto(Producto p,int acum)
{
RProducto b;
b.p = p;
b.acum = acum;
return b;
}

bool rProductoEquals(RProducto a,RProducto b)
{
if(!productoEquals(a.p,b.p)) return false;
if(a.acum!=b.acum) return false;
return true;
}

string rubroToString(Rubro x)
{
char sep = 3;
string sIdRub=to_string(x.idRub);
string sDescr=x.descr;
string sPromo=to_string(x.promo);
return sIdRub+sep+sDescr+sep+sPromo;
}

Rubro rubroFromString(string s)
{
char sep = 3;
Rubro x;
string t0 = getTokenAt(s,sep,0);
x.idRub=stoi(t0);
string t1 = getTokenAt(s,sep,1);
strcpy(x.descr,t1.c_str());
string t2 = getTokenAt(s,sep,2);
x.promo=stod(t2);
return x;
}

string rubroToDebug(Rubro x)
{
stringstream sout;
sout<< "[";
sout << x.idRub;
sout << ",";
sout << x.descr;
sout << ",";
sout << x.promo;
sout<< "]";
return sout.str();
}

string rubroToDebug(string mssg,Rubro x)
{
stringstream sout;
sout<< mssg<<":[";
sout << x.idRub;
sout << ",";
sout << x.descr;
sout << ",";
sout << x.promo;
sout<< "]";
return sout.str();
}

Rubro rubro(int idRub,string descr,double promo)
{
Rubro a;
a.idRub = idRub;
strcpy(a.descr,descr.c_str());
a.promo = promo;
return a;
}

bool rubroEquals(Rubro a,Rubro b)
{
if(a.idRub!=b.idRub) return false;
if(a.promo!=b.promo) return false;
return true;
}

string rRubroToString(RRubro x)
{
char sep = 4;
string sR=rubroToString(x.r);
string sAcum=to_string(x.acum);
return sR+sep+sAcum;
}

RRubro rRubroFromString(string s)
{
char sep = 4;
RRubro x;
string t0 = getTokenAt(s,sep,0);
x.r=rubroFromString(t0);
string t1 = getTokenAt(s,sep,1);
x.acum=stod(t1);
return x;
}

string rRubroToDebug(RRubro x)
{
stringstream sout;
sout<< "[";
sout << rubroToDebug(x.r);
sout << ",";
sout << x.acum;
sout<< "]";
return sout.str();
}

string rRubroToDebug(string mssg,RRubro x)
{
stringstream sout;
sout<< mssg<<":[";
sout << rubroToDebug(x.r);
sout << ",";
sout << x.acum;
sout<< "]";
return sout.str();
}

RRubro rRubro(Rubro r,double acum)
{
RRubro b;
b.r = r;
b.acum = acum;
return b;
}

bool rRubroEquals(RRubro a,RRubro b)
{
if(!rubroEquals(a.r,b.r)) return false;
if(a.acum!=b.acum) return false;
return true;
}

string parToString(Par x)
{
char sep = 5;
string sIdProd=to_string(x.idProd);
string sCant=to_string(x.cant);
return sIdProd+sep+sCant;
}

Par parFromString(string s)
{
char sep = 5;
Par x;
string t0 = getTokenAt(s,sep,0);
x.idProd=stoi(t0);
string t1 = getTokenAt(s,sep,1);
x.cant=stoi(t1);
return x;
}

string parToDebug(Par x)
{
stringstream sout;
sout<< "[";
sout << x.idProd;
sout << ",";
sout << x.cant;
sout<< "]";
return sout.str();
}

string parToDebug(string mssg,Par x)
{
stringstream sout;
sout<< mssg<<":[";
sout << x.idProd;
sout << ",";
sout << x.cant;
sout<< "]";
return sout.str();
}

Par par(int idProd,int cant)
{
Par a;
a.idProd = idProd;
a.cant = cant;
return a;
}

bool parEquals(Par a,Par b)
{
if(a.idProd!=b.idProd) return false;
if(a.cant!=b.cant) return false;
return true;
}

#endif


     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.