Ir ao conteúdo

Lista encadeada, Estrutura de dados.

Saudações,

Para não perder o costume, irei postar outro exercicio resolvido em uma aula. Dessa vez o exercicio é o seguinte:
– Implemenetar o sistema de contabilidade de um mafioso. (outros detalhes continue lendo o post)

O enunciado do mesmo se encontra no “read the rest of this entry” para não deixar o post muito extenso devido ao longo enunciado.

A resolução do mesmo você pode baixar aqui.

Você é um Mafioso informatizado.
Você vai criar um sistema para gerenciar os seus débitos e também as pessoas que devem a você.
Este sistema será baseado em duas listas encadeadas:

(Imagem de exemplo)

* Para isso você vai fazer um programa que manipula mais de uma lista;

* o programa fará isto com um único conjunto de funções e passagem das diversas listas como parâmetros;
* como aplicação imaginemos um sistema de contabilidade simples;
* você vai ter um Plano de Contas constituído por duas listas: débitos e créditos;
* o mesmo conjunto de funções (que você já implementou) vai poder ser utilizado para isso: você somente precisa ampliar o conjunto de parâmetros da função para passar por referência também a lista que você quer alterar.

A passagem de parâmetro da lista deve ser por referência porque você deseja que as alterações sejam persistentes.

Cada lista de débitos ou créditos é constituída por lançamentos. Cada lançamento possui:

* um valor real (positivo);
* um nome. Por exemplo, “Pagar proteção à Mafia”

Estrutura:
tipo tLançamento {
caracter *nome;
real valor;
};

A lista encadeada que conterá os lançamentos terá um elemento de lista definido da seguinte forma:
Estrutura:
tipo tLista {
tLancamento* info;
tLista* proximo;
};
A cabeça de lista de cada lista será uma variável global contendo uma estrutura como abaixo:
tipo cLista {
tLista* lista;
inteiro ultimo;
};

No programa principal você vai definir se vai realizar uma operação de débito ou de crédito e vai chamar as operações sobre listas necessárias, passando a lista correta como parâmetro (por referência) para a função que realiza a operação.

Além das operações básicas que a lIsta vai oferecer, você deve implementar uma operação adicional: totalização. Essa operação funciona assim:

* percorre a lista, escrevendo o nome e o valor correspondente a cada item (débito ou crédito)
* soma o valor em uma variável auxiliar
* escreve ao final o total de débitos ou de créditos, dependendo de qual lista você mandou totalizar.

Publicado emAprendendoCEstrutura de Dados

9.880 Comentários

  1. JulioInino JulioInino

    В этом исследовании рассмотрены методы лечения зависимостей и их эффективность. Мы проанализируем различные подходы, используемые в реабилитационных центрах, и представим данные о результативности программ. Читатели получат надежные и научно обоснованные сведения о данной проблеме.
    Разобраться лучше – наркологический диспансер воронеж

  2. DanielOVelm DanielOVelm

    Мы рассмотрим современные вызовы здравоохранения и пути их решения с помощью технологий и научных исследований. В статье собраны данные о новых лекарствах, методах диагностики и системном подходе к улучшению здоровья населения.
    Посмотреть всё – clinica plus в курске

  3. RusselBoxia RusselBoxia

    Этот документ охватывает важные аспекты медицинской науки, сосредотачиваясь на ключевых вопросах, касающихся здоровья населения. Мы рассматриваем свежие исследования, клинические рекомендации и лучшие практики, которые помогут улучшить качество лечения и профилактики заболеваний. Читатели получат возможность углубиться в различные медицинские дисциплины.
    Практические советы ждут тебя – kursk clinica plus

  4. I’ve got the scars to prove it. You find this amazing deal online: brand new Beamer, unlimited miles, price that makes you smile. Plus they freeze $2500 on your card for a week. Eight years in South Florida and these clowns still almost get me. miami luxury car rental. anyone who’s waited for an Uber in August understands. South of Fifth brunch, Design District shopping, or a spontaneous Keys trip — AC must be arctic cold and unlimited miles non-negotiable. most are shiny turds with five-star fake reviews on Google Maps. what you book is what shows up, no surprises, no fine print nightmares. Here’s the only honest source for premium wheels across South Florida
    porsche rental miami porsche rental miami Yeah parking in South Beach will cost you a nice bottle of wine — but that’s the Miami tax. drive safe and absolutely skip that “windshield protection” upsell — pure profit for them, zero value for you.

  5. This is the kind of article that reminds me why good writing still matters online. The depth here is impressive without ever becoming unnecessarily technical or dense.

  6. Alright let me drop some truth about the Miami rental scene — it’s an absolute minefield. Then you actually go to pick up the car. Totally different vehicle waiting for you — check engine light on, curb rash on every rim, and that “tempting price”? Doesn’t include the mandatory $35 daily toll pass or the $250 cleaning fee they sneak in at the end. Fool me ten times? That’s just the 305 experience. When you need a reliable luxury car rental miami. Miami without solid wheels is basically a punishment. leather seats that won’t cook your back in the July heat. I’ve run through maybe 55 rental companies across Dade, Broward, and Palm Beach. Finally found one outfit that actually delivers what’s promised. Here’s the only straight shooter for premium rides across South Florida
    renting luxury cars near me https://luxury-car-rental-miami-10.com Yeah parking in Brickell will cost you a nice dinner — but that’s just how it is down here. drive safe and absolutely skip that “paint protection” upsell — pure robbery.

  7. Alright listen up because I’m about to save you a massive headache. Miami rental game is wild — half these clowns show you a Mercedes online and hand you a busted Charger with mismatched tires. Plus the fine print says you can’t even drive to Orlando. Fool me four times? Not happening. miami car rental luxury — skip the airport counters entirely. any local will tell you the same thing. leather that doesn’t glue to your legs in July heat. I’ve tested maybe 25 rental outfits across Dade and Broward. what you book is what you get, period. Here’s the only straight-up source for premium wheels in South Florida
    rent urus miami rent urus miami Yeah parking in Brickell will cost you a small mortgage — but that’s city life. Anyway at least there’s one honest rental joint left in this town.

  8. MichaelFlous MichaelFlous

    Эта публикация раскрывает психологические механизмы зависимости и их роль в развитии расстройств. Читатель узнает о том, как психология влияет на формирование зависимостей и как профессиональная помощь может изменить ситуацию.
    Продолжить чтение – нарколог на дом недорого

  9. Seriously, the amount of garbage “luxury” deals here is astonishing. You see a sweet ride online — clean spec, fair price, looks legit. Different car, scratches all over, and that “all-inclusive” price? Yeah that didn’t include insurance, fees, or the mandatory cleaning charge. I’ve lived here for years and still get burned occasionally. miami car rental luxury — don’t just grab the cheapest option on Kayak. ask anyone who’s tried Ubering across the 305 during rush hour. Design District shopping, late-night South Beach cruising, or a spontaneous drive down to Homestead — AC must freeze your teeth and unlimited miles or bust. I’ve gone through maybe 30 rental companies across Dade, Broward, and Palm Beach. Finally found one outfit that actually delivers what’s in the listing. check availability before spring break crowds wipe them out:
    renting luxury cars near me https://luxury-car-rental-miami-5.com also bring quality shades unless you enjoy driving into a nuclear flare every evening. Anyway glad there’s at least one straight shooter left in this rental jungle.

  10. DavidHop DavidHop

    В этой заметке мы представляем шаги, которые помогут в процессе преодоления зависимостей. Рассматриваются стратегии поддержки и чек-листы для тех, кто хочет сделать первый шаг к выздоровлению. Наша цель — вдохновить читателей на положительные изменения и поддержать их в трудных моментах.
    Прочесть заключение эксперта – лечение наркомании в воронеже

  11. Anthonypal Anthonypal

    В этой медицинской статье мы погрузимся в актуальные вопросы здравоохранения и лечения заболеваний. Читатели узнают о современных подходах, методах диагностики и новых открытий в научных исследованиях. Наша цель — донести важную информацию и повысить уровень осведомленности о здоровье.
    Посмотреть подробности – kursk clinica plus

  12. BrianBrimb BrianBrimb

    В данной статье рассматриваются физиологические и эмоциональные аспекты зависимости. Мы обсудим, как организм реагирует на зависимое поведение, и какие методы помогают восстановить здоровье и внутреннее равновесие.
    Полезно знать – клиника плюс королев

  13. Gilbertnog Gilbertnog

    В данной публикации мы поговорим о процессе восстановления от зависимости, о том, как вернуть себе нормальную жизнь. Мы обсудим преодоление трудностей, значимость поддержки и наличие программ реабилитации. Читатели смогут узнать о ключевых шагах к успешному восстановлению.
    Ссылка на источник – анонимное лечение алкоголизма

Deixe um comentário

O seu endereço de e-mail não será publicado. Campos obrigatórios são marcados com *