Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<ctime>
- #include<cstdlib>
- using namespace std;
- struct venta{
- int codigo;
- short cantidad;
- float precio;
- float sumav;
- };
- void codigos(venta *clientes, int *c) {
- for (int i = 0; i <*c; i++)
- {
- clientes[i].codigo=rand() % 1000 + 1000;
- }
- }
- void cantidades(venta *clientes,int *c ) {
- for (int i = 0; i < *c; i++)
- {
- clientes[i].cantidad = rand() % 100;
- }
- }
- void precios(venta *clientes, int *c) {
- for (int i = 0; i < *c; i++)
- {
- clientes[i].precio = (rand() % 200) / 10;
- }
- }
- void suma(venta *clientes, int *c) {
- for (int i = 0; i < *c; i++)
- {
- clientes[i].sumav = clientes[i].cantidad * clientes[i].precio;
- }
- }
- void total(venta *clientes, int *c) {
- float total=0;
- for (int i = 0; i < *c; i++)
- {
- total= total + clientes[i].sumav ;
- }
- }
- int main() {
- int t=rand() % 100 +1;
- venta *clientes = new venta[t];
- srand(time(NULL));
- cin.get();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement