├── .gitignore ├── LICENSE ├── Labs ├── Lab00 │ ├── Lab00.pdf │ └── Leiame.txt ├── Lab01 │ ├── Apoio │ │ ├── Segundo.cpp │ │ └── Terceiro.cpp │ ├── Lab01.pdf │ └── Respostas │ │ ├── lab1q1.cpp │ │ └── lab1q2.cpp ├── Lab02 │ ├── Apoio │ │ ├── ArgcArgv.cpp │ │ └── Primeiro.cpp │ ├── Lab02.pdf │ └── Respostas │ │ ├── lab2q1.cpp │ │ ├── lab2q2.cpp │ │ ├── lab2q3.cpp │ │ └── lab2q4.cpp ├── Lab03 │ ├── Apoio │ │ ├── Cenouras.cpp │ │ ├── ConstVar.cpp │ │ └── LerInfos.cpp │ ├── Lab03.pdf │ └── Respostas │ │ ├── lab3q1.cpp │ │ ├── lab3q2.cpp │ │ └── lab3q3.cpp ├── Lab04 │ ├── Apoio │ │ ├── Auxiliar.cpp │ │ └── FelizNatal.cpp │ ├── Lab04.pdf │ └── Respostas │ │ ├── lab4q1.cpp │ │ ├── lab4q2.cpp │ │ └── lab4q3.cpp ├── Lab05 │ ├── Apoio │ │ ├── Converte.cpp │ │ ├── Flexao.cpp │ │ ├── LocalGlobal.cpp │ │ └── Media.cpp │ ├── Lab05.pdf │ └── Respostas │ │ ├── lab5q1.cpp │ │ ├── lab5q2.cpp │ │ └── lab5q3.cpp ├── Lab06 │ ├── Apoio │ │ ├── ANSIColor.cpp │ │ ├── HorasSeg.cpp │ │ ├── Limites.cpp │ │ ├── Overflow.cpp │ │ ├── TotalMulti.cpp │ │ └── Underflow.cpp │ ├── Lab06.pdf │ └── Respostas │ │ ├── lab6q1.cpp │ │ ├── lab6q2.cpp │ │ └── lab6q3.cpp ├── Lab07 │ ├── Apoio │ │ ├── Booleano.cpp │ │ ├── CharEspecial.cpp │ │ ├── DesligarBit.cpp │ │ ├── LigarBit.cpp │ │ ├── MaisChar.cpp │ │ ├── TestarBit.cpp │ │ └── TipoChar.cpp │ ├── Lab07.pdf │ └── Respostas │ │ ├── lab7q1.cpp │ │ ├── lab7q2.cpp │ │ ├── lab7q3.cpp │ │ ├── lab7q4.cpp │ │ └── lab7q5.cpp ├── Lab08 │ ├── Apoio │ │ ├── Inexato.cpp │ │ ├── Limites.cpp │ │ ├── Precisao1.cpp │ │ └── Precisao2.cpp │ ├── Lab08.pdf │ └── Respostas │ │ ├── lab8q1.cpp │ │ ├── lab8q2.cpp │ │ ├── lab8q3.cpp │ │ ├── lab8q4.cpp │ │ └── lab8q5.cpp ├── Lab09 │ ├── Apoio │ │ ├── ConvAtrib.cpp │ │ ├── ConvExpr.cpp │ │ ├── Divisao.cpp │ │ ├── Modulo.cpp │ │ ├── Operadores.cpp │ │ └── RandMod.cpp │ ├── Lab09.pdf │ └── Respostas │ │ ├── lab9q1.cpp │ │ ├── lab9q2.cpp │ │ ├── lab9q3.cpp │ │ ├── lab9q4.cpp │ │ └── lab9r1.cpp ├── Lab10 │ ├── Apoio │ │ ├── ConstTam.cpp │ │ ├── NaoInicializado.cpp │ │ ├── SomaVetor.cpp │ │ └── Vetores.cpp │ ├── Lab10.pdf │ └── Respostas │ │ ├── lab10q1.cpp │ │ ├── lab10q2.cpp │ │ └── lab10q3.cpp ├── Lab11 │ ├── Apoio │ │ ├── AtribConcat.cpp │ │ ├── Casa.cpp │ │ ├── Comprimento.cpp │ │ ├── Copiando.cpp │ │ ├── Cowboy.cpp │ │ ├── Nome.cpp │ │ ├── Sobremesa.cpp │ │ └── TipoString.cpp │ ├── Lab11.pdf │ └── Respostas │ │ ├── lab11q1.cpp │ │ ├── lab11q2.cpp │ │ ├── lab11q3.cpp │ │ ├── lab11q4.cpp │ │ └── lab11q5.cpp ├── Lab12 │ ├── Apoio │ │ ├── IniReg.cpp │ │ ├── SemNome.cpp │ │ └── VetReg.cpp │ ├── Lab12.pdf │ └── Respostas │ │ ├── lab12q1.cpp │ │ ├── lab12q2.cpp │ │ ├── lab12q3.cpp │ │ ├── lab12q4.cpp │ │ └── lab12r2.cpp ├── Lab13 │ ├── Apoio │ │ ├── Baby.cpp │ │ ├── CharInt.cpp │ │ ├── Meses.cpp │ │ └── RegKey.cpp │ ├── Lab13.pdf │ └── Respostas │ │ ├── lab13q1.cpp │ │ └── lab13q2.cpp ├── Lab14 │ ├── Apoio │ │ ├── Apontador.cpp │ │ ├── Endereco.cpp │ │ ├── Estrela.cpp │ │ └── StringPtr.cpp │ ├── Lab14.pdf │ └── Respostas │ │ ├── lab14q1.cpp │ │ ├── lab14q2.cpp │ │ ├── lab14q3.cpp │ │ └── lab14q4.cpp ├── Lab15 │ ├── Apoio │ │ ├── NewSize.cpp │ │ ├── RegDin.cpp │ │ ├── Triplo.cpp │ │ └── VetDin.cpp │ ├── Lab15.pdf │ └── Respostas │ │ ├── lab15q1.cpp │ │ ├── lab15q2.cpp │ │ ├── lab15q3.cpp │ │ ├── lab15q4.cpp │ │ └── lab15q5.cpp ├── Lab16 │ ├── Apoio │ │ ├── Crescente.cpp │ │ ├── Fatorial.cpp │ │ ├── Inverte.cpp │ │ ├── Limite.cpp │ │ ├── Repetir.cpp │ │ └── ValorExpr.cpp │ ├── Lab16.pdf │ └── Respostas │ │ ├── lab16q1.cpp │ │ └── lab16q2.cpp ├── Lab17 │ ├── Apoio │ │ ├── Acumulo.cpp │ │ ├── Aninhados.cpp │ │ ├── Incremento.cpp │ │ ├── Invertido.cpp │ │ ├── Modifica.cpp │ │ └── Passo.cpp │ ├── Lab17.pdf │ └── Respostas │ │ ├── lab17q1.cpp │ │ ├── lab17q2 .cpp │ │ └── lab17q3.cpp ├── Lab18 │ ├── Apoio │ │ ├── Favorito.cpp │ │ ├── FloatCmp.cpp │ │ ├── Infinito.cpp │ │ ├── Moleque.cpp │ │ ├── SomaNums.cpp │ │ └── Vertical.cpp │ ├── Lab18.pdf │ └── Respostas │ │ ├── lab18q1.cpp │ │ ├── lab18q2.cpp │ │ └── lab18q3.cpp ├── Lab19 │ ├── Apoio │ │ ├── Matriz.cpp │ │ ├── MaxTemp.cpp │ │ ├── Repete1.cpp │ │ ├── Repete2.cpp │ │ ├── Repete3.cpp │ │ └── Vetor2D.cpp │ ├── Lab19.pdf │ └── Respostas │ │ ├── lab19q1.cpp │ │ ├── lab19q2.cpp │ │ ├── lab19q3.cpp │ │ └── lab19q4.cpp ├── Lab20 │ ├── Apoio │ │ ├── Advinhacao.cpp │ │ ├── Confusao.cpp │ │ └── Espacos.cpp │ ├── Lab20.pdf │ └── Respostas │ │ ├── lab20q1.cpp │ │ ├── lab20q2.cpp │ │ ├── lab20q3.cpp │ │ └── lab20q4.cpp ├── Lab21 │ ├── Apoio │ │ ├── Faixa.cpp │ │ ├── Formatando.cpp │ │ ├── Inteiro.cpp │ │ └── Vizinhos.cpp │ ├── Lab21.pdf │ └── Respostas │ │ ├── lab21q1.cpp │ │ ├── lab21q2.cpp │ │ ├── lab21q3.cpp │ │ ├── lab21q4.cpp │ │ └── lab21r5.cpp ├── Lab22 │ ├── Apoio │ │ ├── Classifica.cpp │ │ ├── Cores.cpp │ │ ├── Lanche.cpp │ │ ├── Maior.cpp │ │ └── Menu.cpp │ ├── Lab22.pdf │ └── Respostas │ │ ├── lab22q1.cpp │ │ ├── lab22q2.cpp │ │ ├── lab22q3.cpp │ │ ├── lab22q4.cpp │ │ └── lab22q5.cpp ├── Lab23 │ ├── Apoio │ │ ├── Lab23r02.cpp │ │ ├── MediaArq.cpp │ │ ├── Promocional.cpp │ │ └── sol.txt │ ├── Lab23.pdf │ └── Respostas │ │ ├── lab23q1.cpp │ │ ├── lab23q2.cpp │ │ ├── lab23q3.cpp │ │ ├── lab23q4.cpp │ │ ├── lab23q5.cpp │ │ ├── pescado.txt │ │ ├── resultado.txt │ │ ├── situacao.txt │ │ ├── texto.txt │ │ └── vol.txt ├── Lab24 │ ├── Apoio │ │ ├── Escrita.cpp │ │ ├── Leitura.cpp │ │ └── Planetas.cpp │ ├── Lab24.pdf │ └── Respostas │ │ ├── imagem.cor │ │ ├── lab24q1.cpp │ │ ├── lab24q2.cpp │ │ ├── lab24q3.cpp │ │ ├── lab24q4.cpp │ │ ├── lab24r1.cpp │ │ ├── lab24r2.cpp │ │ ├── lab24r3.cpp │ │ ├── mensagem.cor │ │ ├── peixes.dat │ │ ├── pescado.dat │ │ └── pescado.txt ├── Lab25 │ ├── Apoio │ │ ├── FaixaVetor.cpp │ │ ├── Imoveis.cpp │ │ ├── SomaVetor.cpp │ │ ├── TamVet.cpp │ │ └── Vetores.cpp │ ├── Lab25.pdf │ └── Respostas │ │ ├── lab25q1.cpp │ │ ├── lab25q2.cpp │ │ └── lab25q3.cpp ├── Lab26 │ ├── Apoio │ │ ├── CharEmString.cpp │ │ ├── InverteStr.cpp │ │ ├── InverteStr2.cpp │ │ ├── InverteStr3.cpp │ │ ├── Planetas.cpp │ │ ├── TempoPtr.cpp │ │ └── TempoValor.cpp │ ├── Lab26.pdf │ └── Respostas │ │ ├── lab26q1.cpp │ │ ├── lab26q2.cpp │ │ └── lab26q3.cpp ├── Lab27 │ ├── Apoio │ │ ├── Estimar.cpp │ │ └── Inline.cpp │ ├── Lab27.pdf │ └── Respostas │ │ ├── lab27q1.cpp │ │ ├── lab27q2.cpp │ │ └── lab27q3.cpp ├── Lab28 │ ├── Apoio │ │ ├── Atleta.cpp │ │ ├── Coelhos.cpp │ │ ├── Roedores.cpp │ │ ├── auxiliar.cpp │ │ ├── estatico.cpp │ │ └── principal.cpp │ ├── Lab28.pdf │ └── Respostas │ │ ├── lab28q1.cpp │ │ ├── lab28q2.cpp │ │ ├── lab28q3.cpp │ │ └── lab28q4.cpp └── Lab29 │ ├── Apoio │ ├── Linha.cpp │ ├── Tamanho.cpp │ └── Trocar.cpp │ ├── Lab29.pdf │ └── Respostas │ ├── lab29q1.cpp │ ├── lab29q2.cpp │ ├── lab29q3.cpp │ ├── lab29q4.cpp │ └── lab29q5.cpp ├── README.md ├── Slides ├── 00. Introdução.pptx ├── 01. Ambiente de Trabalho.pptx ├── 02. Introdução ao Cpp.pptx ├── 03. Variáveis Constantes e Atribuição.pptx ├── 04. Modularidade e Funções.pptx ├── 05. Criação de Funções.pptx ├── 06. Tipos Inteiros.pptx ├── 07. Tipos Caractere e Booleano.pptx ├── 08. Tipos Ponto Flutuante.pptx ├── 09. Operadores Aritméticos.pptx ├── 10. Vetores.pptx ├── 11. Strings.pptx ├── 12. Registros.pptx ├── 13. Uniões e Enumerações.pptx ├── 14. Ponteiros.pptx ├── 15. Alocação Dinâmica de Memória.pptx ├── 16. Laço de Repetição For.pptx ├── 17. Aplicações do Laço For.pptx ├── 18. Laços de Repetição While e Do-While.pptx ├── 19. Aplicações dos Laços de Repetição.pptx ├── 20. Instrução de Desvio If.pptx ├── 21. Operadores Lógicos.pptx ├── 22. Instrução de Desvio Switch.pptx ├── 23. Arquivos Texto.pptx ├── 24. Arquivos Binários.pptx ├── 25. Funções com Vetores.pptx ├── 26. Funções com Strings e Registros.pptx ├── 27. Funções Inline e Ponteiros para Funções.pptx ├── 28. Armazenamento e Referências.pptx └── 29. Templates e Sobrecarga de Funções.pptx ├── Trabalhos ├── TP1.pdf ├── TP2.pdf └── TP3.pdf └── VisualStudio.pdf /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.rsuser 8 | *.suo 9 | *.user 10 | *.userosscache 11 | *.sln.docstates 12 | 13 | # User-specific files (MonoDevelop/Xamarin Studio) 14 | *.userprefs 15 | 16 | # Mono auto generated files 17 | mono_crash.* 18 | 19 | # Build results 20 | [Dd]ebug/ 21 | [Dd]ebugPublic/ 22 | [Rr]elease/ 23 | [Rr]eleases/ 24 | x64/ 25 | x86/ 26 | [Aa][Rr][Mm]/ 27 | [Aa][Rr][Mm]64/ 28 | bld/ 29 | [Bb]in/ 30 | [Oo]bj/ 31 | [Ll]og/ 32 | [Ll]ogs/ 33 | 34 | # Visual Studio 2015/2017 cache/options directory 35 | .vs/ 36 | # Uncomment if you have tasks that create the project's static files in wwwroot 37 | #wwwroot/ 38 | 39 | # Visual Studio 2017 auto generated files 40 | Generated\ Files/ 41 | 42 | # MSTest test Results 43 | [Tt]est[Rr]esult*/ 44 | [Bb]uild[Ll]og.* 45 | 46 | # NUnit 47 | *.VisualState.xml 48 | TestResult.xml 49 | nunit-*.xml 50 | 51 | # Build Results of an ATL Project 52 | [Dd]ebugPS/ 53 | [Rr]eleasePS/ 54 | dlldata.c 55 | 56 | # Benchmark Results 57 | BenchmarkDotNet.Artifacts/ 58 | 59 | # .NET Core 60 | project.lock.json 61 | project.fragment.lock.json 62 | artifacts/ 63 | 64 | # StyleCop 65 | StyleCopReport.xml 66 | 67 | # Files built by Visual Studio 68 | *_i.c 69 | *_p.c 70 | *_h.h 71 | *.ilk 72 | *.meta 73 | *.obj 74 | *.iobj 75 | *.pch 76 | *.pdb 77 | *.ipdb 78 | *.pgc 79 | *.pgd 80 | *.rsp 81 | *.sbr 82 | *.tlb 83 | *.tli 84 | *.tlh 85 | *.tmp 86 | *.tmp_proj 87 | *_wpftmp.csproj 88 | *.log 89 | *.vspscc 90 | *.vssscc 91 | .builds 92 | *.pidb 93 | *.svclog 94 | *.scc 95 | 96 | # Chutzpah Test files 97 | _Chutzpah* 98 | 99 | # Visual C++ cache files 100 | ipch/ 101 | *.aps 102 | *.ncb 103 | *.opendb 104 | *.opensdf 105 | *.sdf 106 | *.cachefile 107 | *.VC.db 108 | *.VC.VC.opendb 109 | 110 | # Visual Studio profiler 111 | *.psess 112 | *.vsp 113 | *.vspx 114 | *.sap 115 | 116 | # Visual Studio Trace Files 117 | *.e2e 118 | 119 | # TFS 2012 Local Workspace 120 | $tf/ 121 | 122 | # Guidance Automation Toolkit 123 | *.gpState 124 | 125 | # ReSharper is a .NET coding add-in 126 | _ReSharper*/ 127 | *.[Rr]e[Ss]harper 128 | *.DotSettings.user 129 | 130 | # TeamCity is a build add-in 131 | _TeamCity* 132 | 133 | # DotCover is a Code Coverage Tool 134 | *.dotCover 135 | 136 | # AxoCover is a Code Coverage Tool 137 | .axoCover/* 138 | !.axoCover/settings.json 139 | 140 | # Visual Studio code coverage results 141 | *.coverage 142 | *.coveragexml 143 | 144 | # NCrunch 145 | _NCrunch_* 146 | .*crunch*.local.xml 147 | nCrunchTemp_* 148 | 149 | # MightyMoose 150 | *.mm.* 151 | AutoTest.Net/ 152 | 153 | # Web workbench (sass) 154 | .sass-cache/ 155 | 156 | # Installshield output folder 157 | [Ee]xpress/ 158 | 159 | # DocProject is a documentation generator add-in 160 | DocProject/buildhelp/ 161 | DocProject/Help/*.HxT 162 | DocProject/Help/*.HxC 163 | DocProject/Help/*.hhc 164 | DocProject/Help/*.hhk 165 | DocProject/Help/*.hhp 166 | DocProject/Help/Html2 167 | DocProject/Help/html 168 | 169 | # Click-Once directory 170 | publish/ 171 | 172 | # Publish Web Output 173 | *.[Pp]ublish.xml 174 | *.azurePubxml 175 | # Note: Comment the next line if you want to checkin your web deploy settings, 176 | # but database connection strings (with potential passwords) will be unencrypted 177 | *.pubxml 178 | *.publishproj 179 | 180 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 181 | # checkin your Azure Web App publish settings, but sensitive information contained 182 | # in these scripts will be unencrypted 183 | PublishScripts/ 184 | 185 | # NuGet Packages 186 | *.nupkg 187 | # NuGet Symbol Packages 188 | *.snupkg 189 | # The packages folder can be ignored because of Package Restore 190 | **/[Pp]ackages/* 191 | # except build/, which is used as an MSBuild target. 192 | !**/[Pp]ackages/build/ 193 | # Uncomment if necessary however generally it will be regenerated when needed 194 | #!**/[Pp]ackages/repositories.config 195 | # NuGet v3's project.json files produces more ignorable files 196 | *.nuget.props 197 | *.nuget.targets 198 | 199 | # Microsoft Azure Build Output 200 | csx/ 201 | *.build.csdef 202 | 203 | # Microsoft Azure Emulator 204 | ecf/ 205 | rcf/ 206 | 207 | # Windows Store app package directories and files 208 | AppPackages/ 209 | BundleArtifacts/ 210 | Package.StoreAssociation.xml 211 | _pkginfo.txt 212 | *.appx 213 | *.appxbundle 214 | *.appxupload 215 | 216 | # Visual Studio cache files 217 | # files ending in .cache can be ignored 218 | *.[Cc]ache 219 | # but keep track of directories ending in .cache 220 | !?*.[Cc]ache/ 221 | 222 | # Others 223 | ClientBin/ 224 | ~$* 225 | *~ 226 | *.dbmdl 227 | *.dbproj.schemaview 228 | *.jfm 229 | *.pfx 230 | *.publishsettings 231 | orleans.codegen.cs 232 | 233 | # Including strong name files can present a security risk 234 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 235 | #*.snk 236 | 237 | # Since there are multiple workflows, uncomment next line to ignore bower_components 238 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 239 | #bower_components/ 240 | 241 | # RIA/Silverlight projects 242 | Generated_Code/ 243 | 244 | # Backup & report files from converting an old project file 245 | # to a newer Visual Studio version. Backup files are not needed, 246 | # because we have git ;-) 247 | _UpgradeReport_Files/ 248 | Backup*/ 249 | UpgradeLog*.XML 250 | UpgradeLog*.htm 251 | ServiceFabricBackup/ 252 | *.rptproj.bak 253 | 254 | # SQL Server files 255 | *.mdf 256 | *.ldf 257 | *.ndf 258 | 259 | # Business Intelligence projects 260 | *.rdl.data 261 | *.bim.layout 262 | *.bim_*.settings 263 | *.rptproj.rsuser 264 | *- [Bb]ackup.rdl 265 | *- [Bb]ackup ([0-9]).rdl 266 | *- [Bb]ackup ([0-9][0-9]).rdl 267 | 268 | # Microsoft Fakes 269 | FakesAssemblies/ 270 | 271 | # GhostDoc plugin setting file 272 | *.GhostDoc.xml 273 | 274 | # Node.js Tools for Visual Studio 275 | .ntvs_analysis.dat 276 | node_modules/ 277 | 278 | # Visual Studio 6 build log 279 | *.plg 280 | 281 | # Visual Studio 6 workspace options file 282 | *.opt 283 | 284 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 285 | *.vbw 286 | 287 | # Visual Studio LightSwitch build output 288 | **/*.HTMLClient/GeneratedArtifacts 289 | **/*.DesktopClient/GeneratedArtifacts 290 | **/*.DesktopClient/ModelManifest.xml 291 | **/*.Server/GeneratedArtifacts 292 | **/*.Server/ModelManifest.xml 293 | _Pvt_Extensions 294 | 295 | # Paket dependency manager 296 | .paket/paket.exe 297 | paket-files/ 298 | 299 | # FAKE - F# Make 300 | .fake/ 301 | 302 | # CodeRush personal settings 303 | .cr/personal 304 | 305 | # Python Tools for Visual Studio (PTVS) 306 | __pycache__/ 307 | *.pyc 308 | 309 | # Cake - Uncomment if you are using it 310 | # tools/** 311 | # !tools/packages.config 312 | 313 | # Tabs Studio 314 | *.tss 315 | 316 | # Telerik's JustMock configuration file 317 | *.jmconfig 318 | 319 | # BizTalk build output 320 | *.btp.cs 321 | *.btm.cs 322 | *.odx.cs 323 | *.xsd.cs 324 | 325 | # OpenCover UI analysis results 326 | OpenCover/ 327 | 328 | # Azure Stream Analytics local run output 329 | ASALocalRun/ 330 | 331 | # MSBuild Binary and Structured Log 332 | *.binlog 333 | 334 | # NVidia Nsight GPU debugger configuration file 335 | *.nvuser 336 | 337 | # MFractors (Xamarin productivity tool) working folder 338 | .mfractor/ 339 | 340 | # Local History for Visual Studio 341 | .localhistory/ 342 | 343 | # BeatPulse healthcheck temp database 344 | healthchecksdb 345 | 346 | # Backup folder for Package Reference Convert tool in Visual Studio 2017 347 | MigrationBackup/ 348 | 349 | # Ionide (cross platform F# VS Code tools) working folder 350 | .ionide/ 351 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Judson Santiago 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Labs/Lab00/Lab00.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab00/Lab00.pdf -------------------------------------------------------------------------------- /Labs/Lab00/Leiame.txt: -------------------------------------------------------------------------------- 1 | Cada aula é acompanhada de um laboratório. Os laboratórios podem conter até três seções diferentes: 2 | 3 | 1. Revisão: exercícios feitos em sala de aula para demonstrar pontos importantes sobre os assuntos vistos 4 | 2. Fixação: exercícios com respostas para fixar os assuntos da aula 5 | 3. Aprendizagem: exercícios sem respostas para verificar o aprendizado -------------------------------------------------------------------------------- /Labs/Lab01/Apoio/Segundo.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab01/Apoio/Segundo.cpp -------------------------------------------------------------------------------- /Labs/Lab01/Apoio/Terceiro.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab01/Apoio/Terceiro.cpp -------------------------------------------------------------------------------- /Labs/Lab01/Lab01.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab01/Lab01.pdf -------------------------------------------------------------------------------- /Labs/Lab01/Respostas/lab1q1.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab01/Respostas/lab1q1.cpp -------------------------------------------------------------------------------- /Labs/Lab01/Respostas/lab1q2.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab01/Respostas/lab1q2.cpp -------------------------------------------------------------------------------- /Labs/Lab02/Apoio/ArgcArgv.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main(int argc, char ** argv) 5 | { 6 | cout << "Programa: " << argv[0] << endl; 7 | 8 | if (argc > 1) 9 | cout << "Arg: " << argv[1] << endl; 10 | 11 | return 0; 12 | } -------------------------------------------------------------------------------- /Labs/Lab02/Apoio/Primeiro.cpp: -------------------------------------------------------------------------------- 1 | // primeiro.cpp - mostra uma mensagem 2 | #include 3 | using namespace std; 4 | 5 | int main() 6 | { 7 | cout << "Bem vindo ao C++"; 8 | cout << endl; 9 | cout << "Meu primeiro programa!" << endl; 10 | 11 | return 0; 12 | } -------------------------------------------------------------------------------- /Labs/Lab02/Lab02.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab02/Lab02.pdf -------------------------------------------------------------------------------- /Labs/Lab02/Respostas/lab2q1.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() 5 | { 6 | cout << "Anton Bruckner" << endl; 7 | cout << "180 Speedway Drive\n"; 8 | cout << "Sparta, KY" << endl; 9 | 10 | return 0; 11 | } -------------------------------------------------------------------------------- /Labs/Lab02/Respostas/lab2q2.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() 5 | { 6 | cout << "Anton Bruckner" << endl; 7 | cout << "Anton\nBruckner" << endl; 8 | cout << "Anton"; 9 | cout << " Bruckner" << endl; 10 | 11 | return 0; 12 | } -------------------------------------------------------------------------------- /Labs/Lab02/Respostas/lab2q3.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() 5 | { 6 | system("cls"); // limpa a tela 7 | 8 | cout << "\n\n"; 9 | cout << "\n\t\xDC\xDC\xDB \xDB\xDB\xDB\xDB\xDB\xDB"; 10 | cout << "\n\t\xDFO\xDF\xDF\xDF\xDF\xDFOO\xDF"; 11 | cout << "\n\n"; 12 | 13 | cout << "\n\t\xC9\xCD\xCD\xCD\xCD\xCD\xBB"; 14 | cout << "\n\t\xBA C++ \xBA"; 15 | cout << "\n\t\xC8\xCD\xCD\xCD\xCD\xCD\xBC"; 16 | cout << "\n\n"; 17 | 18 | return 0; 19 | } -------------------------------------------------------------------------------- /Labs/Lab02/Respostas/lab2q4.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() 5 | { 6 | cout << left; cout.width(10); cout << "Produto"; cout << right; cout.width(6); cout << "Quant"; cout.width(8); cout << "Valor" << endl; 7 | cout << left; cout.width(10); cout << "-------"; cout << right; cout.width(6); cout << "-----"; cout.width(8); cout << "-----" << endl; 8 | cout << left; cout.width(10); cout << "Abacaxi"; cout << right; cout.width(6); cout << "2.5"; cout.width(8); cout << "1.99" << endl; 9 | cout << left; cout.width(10); cout << "Cenoura"; cout << right; cout.width(6); cout << "4.6"; cout.width(8); cout << "5.90" << endl; 10 | cout << left; cout.width(10); cout << "Limao"; cout << right; cout.width(6); cout << "20.5"; cout.width(8); cout << "10.40" << endl; 11 | cout << left; cout.width(10); cout << "Maca"; cout << right; cout.width(6); cout << "345.0"; cout.width(8); cout << "120.30" << endl; 12 | cout << left; cout.width(10); cout << "Goiaba"; cout << right; cout.width(6); cout << "20.5"; cout.width(8); cout << "56.00" << endl; 13 | 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /Labs/Lab03/Apoio/Cenouras.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab03/Apoio/Cenouras.cpp -------------------------------------------------------------------------------- /Labs/Lab03/Apoio/ConstVar.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab03/Apoio/ConstVar.cpp -------------------------------------------------------------------------------- /Labs/Lab03/Apoio/LerInfos.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab03/Apoio/LerInfos.cpp -------------------------------------------------------------------------------- /Labs/Lab03/Lab03.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab03/Lab03.pdf -------------------------------------------------------------------------------- /Labs/Lab03/Respostas/lab3q1.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() 5 | { 6 | int segundos, minutos; 7 | cout << "Digite uma quantidade de minutos: "; 8 | cin >> minutos; 9 | segundos = 100 * minutos; 10 | cout << "Existem " << segundos << " segundos em " 11 | << minutos << " minutos."; 12 | cout << endl; 13 | 14 | return 0; 15 | } -------------------------------------------------------------------------------- /Labs/Lab03/Respostas/lab3q2.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() 5 | { 6 | int medida; 7 | medida = 10; 8 | 9 | cout << "Medida: " << medida << endl; 10 | cout << "2x Medida: " << 2 * medida << endl; 11 | cout << "Medida ao quadrado: " << medida * medida << endl; 12 | 13 | return 0; 14 | } -------------------------------------------------------------------------------- /Labs/Lab03/Respostas/lab3q3.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() 5 | { 6 | cout << "Digite sua idade: "; 7 | int idade; 8 | cin >> idade; 9 | 10 | int dias; 11 | dias = idade * 365; 12 | 13 | cout << idade << " anos equivalem a " << dias << " dias.\n"; 14 | 15 | return 0; 16 | } -------------------------------------------------------------------------------- /Labs/Lab04/Apoio/Auxiliar.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab04/Apoio/Auxiliar.cpp -------------------------------------------------------------------------------- /Labs/Lab04/Apoio/FelizNatal.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab04/Apoio/FelizNatal.cpp -------------------------------------------------------------------------------- /Labs/Lab04/Lab04.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab04/Lab04.pdf -------------------------------------------------------------------------------- /Labs/Lab04/Respostas/lab4q1.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | void Sorria(void); 5 | 6 | int main() 7 | { 8 | Sorria(); Sorria(); Sorria(); Sorria(); 9 | cout << endl; 10 | Sorria(); Sorria(); 11 | cout << endl; 12 | Sorria(); 13 | cout << endl; 14 | 15 | return 0; 16 | } 17 | 18 | void Sorria(void) 19 | { 20 | cout << "Sorria! "; 21 | } -------------------------------------------------------------------------------- /Labs/Lab04/Respostas/lab4q2.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | void Linha(void); 5 | void Pequena(void); 6 | void Media(void); 7 | void Grande(void); 8 | 9 | int main() 10 | { 11 | Pequena(); 12 | Media(); 13 | Grande(); 14 | cout << "Programacao de Computadores" << endl; 15 | Grande(); 16 | Media(); 17 | Pequena(); 18 | 19 | return 0; 20 | } 21 | 22 | void Linha(void) 23 | { 24 | cout << "----------"; 25 | } 26 | 27 | void Pequena(void) 28 | { 29 | Linha(); 30 | cout << endl; 31 | } 32 | 33 | void Media(void) 34 | { 35 | Linha(); 36 | Linha(); 37 | cout << endl; 38 | } 39 | 40 | void Grande(void) 41 | { 42 | Linha(); 43 | Linha(); 44 | Linha(); 45 | cout << endl; 46 | } -------------------------------------------------------------------------------- /Labs/Lab04/Respostas/lab4q3.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | void UmTres(void); 5 | void Dois(void); 6 | 7 | int main() 8 | { 9 | cout << "Comecando agora:\n"; 10 | UmTres(); 11 | cout << "Pronto!\n"; 12 | 13 | return 0; 14 | } 15 | 16 | void UmTres(void) 17 | { 18 | cout << "Um "; 19 | Dois(); 20 | cout << "Tres\n"; 21 | } 22 | 23 | void Dois(void) 24 | { 25 | cout << "Dois "; 26 | } -------------------------------------------------------------------------------- /Labs/Lab05/Apoio/Converte.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab05/Apoio/Converte.cpp -------------------------------------------------------------------------------- /Labs/Lab05/Apoio/Flexao.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab05/Apoio/Flexao.cpp -------------------------------------------------------------------------------- /Labs/Lab05/Apoio/LocalGlobal.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab05/Apoio/LocalGlobal.cpp -------------------------------------------------------------------------------- /Labs/Lab05/Apoio/Media.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab05/Apoio/Media.cpp -------------------------------------------------------------------------------- /Labs/Lab05/Lab05.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab05/Lab05.pdf -------------------------------------------------------------------------------- /Labs/Lab05/Respostas/lab5q1.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | void mostraTempo(int, int); 5 | 6 | int main() 7 | { 8 | int horas, mins; 9 | cout << "Entre com o numero de horas: "; 10 | cin >> horas; 11 | cout << "Entre com o numero de minutos: "; 12 | cin >> mins; 13 | 14 | cout << "Agora sao "; 15 | mostraTempo(horas,mins); 16 | cout << endl; 17 | 18 | return 0; 19 | } 20 | 21 | void mostraTempo(int hora, int min) 22 | { 23 | cout << hora << ":" << min; 24 | } -------------------------------------------------------------------------------- /Labs/Lab05/Respostas/lab5q2.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | double converTemp(double); 5 | 6 | int main() 7 | { 8 | cout << "Digite uma temperatura em graus Celsius: "; 9 | double celsius; 10 | cin >> celsius; 11 | 12 | double fahr; 13 | fahr = converTemp(celsius); 14 | cout << celsius << " graus Celsius equivalem a " << fahr << " graus Fahrenheit.\n"; 15 | 16 | return 0; 17 | } 18 | 19 | double converTemp(double temp) 20 | { 21 | return 1.8 * temp + 32.0; 22 | } -------------------------------------------------------------------------------- /Labs/Lab05/Respostas/lab5q3.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | double harmonica(double, double); 5 | 6 | int main() 7 | { 8 | double num1, num2; 9 | cout << "Entre com um numero: "; 10 | cin >> num1; 11 | cout << "Entre com outro numero: "; 12 | cin >> num2; 13 | 14 | cout << "A media harmonica dos numeros e " << harmonica(num1,num2) << endl; 15 | 16 | return 0; 17 | } 18 | 19 | double harmonica(double x, double y) 20 | { 21 | return (2.0 * x * y) / (x + y); 22 | } -------------------------------------------------------------------------------- /Labs/Lab06/Apoio/ANSIColor.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | #define black "\033[7;37;40m" 5 | #define yellow "\033[1;33;44m" 6 | #define green "\033[32m" 7 | #define red "\033[4;31m" 8 | #define foreg "\033[38;5;154m" 9 | #define backg "\033[38;5;0;48;5;154m" 10 | #define default "\033[m" 11 | 12 | int main() 13 | { 14 | cout << black << "Preto no Branco" << default << endl; 15 | cout << yellow << "Amarelo Intenso com Azul" << default << endl; 16 | cout << green << "Verde Normal" << default << endl; 17 | cout << red << "Vermelho Sublinhado" << default << endl; 18 | cout << foreg << "256 Cores" << default << endl; 19 | cout << backg << "256 Cores" << default << endl; 20 | 21 | return 0; 22 | } -------------------------------------------------------------------------------- /Labs/Lab06/Apoio/HorasSeg.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab06/Apoio/HorasSeg.cpp -------------------------------------------------------------------------------- /Labs/Lab06/Apoio/Limites.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | 5 | int main() 6 | { 7 | int n_int = INT_MAX; 8 | short n_short = SHRT_MAX; 9 | long n_long = LONG_MAX; 10 | long long n_llong = LLONG_MAX; 11 | 12 | cout << "short tem " << sizeof n_short << " bytes." << endl; 13 | cout << "int tem " << sizeof(int) << " bytes." << endl; 14 | cout << "long tem " << sizeof n_long << " bytes." << endl; 15 | cout << "long long tem " << sizeof n_llong << " bytes.\n" << endl; 16 | 17 | cout << "Valores Maximos:\n"; 18 | cout << "short: " << n_short << endl; 19 | cout << "int: " << n_int << endl; 20 | cout << "long: " << n_long << endl; 21 | cout << "long long: " << n_llong << endl << endl; 22 | 23 | return 0; 24 | } 25 | -------------------------------------------------------------------------------- /Labs/Lab06/Apoio/Overflow.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | 5 | int main() 6 | { 7 | short pedro = SHRT_MAX; 8 | unsigned short maria = SHRT_MAX; 9 | 10 | cout << "Pedro tem " << pedro << " Reais." << endl; 11 | cout << "Maria tem " << maria << " Reais." << endl; 12 | 13 | cout << endl << "Adicionando 1 Real para cada um..." << endl << endl; 14 | pedro = pedro + 1; 15 | maria = maria + 1; 16 | 17 | cout << "Agora Pedro tem " << pedro << " Reais." << endl; 18 | cout << "Agora Maria tem " << maria << " Reais." << endl; 19 | 20 | return 0; 21 | } -------------------------------------------------------------------------------- /Labs/Lab06/Apoio/TotalMulti.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() 4 | { 5 | int total = 100000000 + 200000000; 6 | int multi = 100000000 * 200000000; 7 | 8 | cout << "Total: " << total << endl; 9 | cout << "Multi: " << multi << endl; 10 | 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /Labs/Lab06/Apoio/Underflow.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #define ZERO 0 4 | using namespace std; 5 | int main() 6 | { 7 | short pedro = ZERO; 8 | unsigned short maria = ZERO; 9 | 10 | cout << "Pedro tem " << pedro << " Reais." << endl; 11 | cout << "Maria tem " << maria << " Reais." << endl; 12 | 13 | cout << endl << "Tirando 1 Real de cada um..." << endl << endl; 14 | pedro = pedro - 1; 15 | maria = maria - 1; 16 | 17 | cout << "Agora Pedro tem " << pedro << " Reais." << endl; 18 | cout << "Agora Maria tem " << maria << " Reais." << endl; 19 | 20 | return 0; 21 | } -------------------------------------------------------------------------------- /Labs/Lab06/Lab06.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab06/Lab06.pdf -------------------------------------------------------------------------------- /Labs/Lab06/Respostas/lab6q1.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | #define ZERO 0 5 | 6 | int main() 7 | { 8 | int total = ZERO; 9 | cout << "Inicialmente total = " << total << " (ZERO)\n"; 10 | total = 50; 11 | cout << "Depois da atribuicao total = " << total << endl; 12 | 13 | return ZERO; 14 | } -------------------------------------------------------------------------------- /Labs/Lab06/Respostas/lab6q2.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab06/Respostas/lab6q2.cpp -------------------------------------------------------------------------------- /Labs/Lab06/Respostas/lab6q3.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() 5 | { 6 | short v1; 7 | int v2; 8 | long v3; 9 | long long v4; 10 | 11 | cout << "short: " << sizeof v1 << " bytes" << endl; 12 | cout << "int: " << sizeof v2 << " bytes" << endl; 13 | cout << "long: " << sizeof v3 << " bytes" << endl; 14 | cout << "long long: " << sizeof v4 << " bytes" << endl; 15 | cout << endl; 16 | 17 | int total = sizeof v1 + sizeof v2 + sizeof v3 + sizeof v4; 18 | cout << "Total de bytes usados: " << total << endl; 19 | 20 | system("pause"); 21 | return 0; 22 | } -------------------------------------------------------------------------------- /Labs/Lab07/Apoio/Booleano.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab07/Apoio/Booleano.cpp -------------------------------------------------------------------------------- /Labs/Lab07/Apoio/CharEspecial.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab07/Apoio/CharEspecial.cpp -------------------------------------------------------------------------------- /Labs/Lab07/Apoio/DesligarBit.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() 5 | { 6 | cout << "Desligar qual bit? "; 7 | int bit; 8 | cin >> bit; 9 | unsigned char binaop = 1 << bit; 10 | 11 | unsigned char estado = 8; 12 | estado = estado & ~binaop; 13 | 14 | cout << int(estado) << endl; 15 | 16 | return 0; 17 | } -------------------------------------------------------------------------------- /Labs/Lab07/Apoio/LigarBit.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() 5 | { 6 | cout << "Ligar qual bit? "; 7 | int bit; 8 | cin >> bit; 9 | unsigned char binaop = 1 << bit; 10 | 11 | unsigned char estado = 0; 12 | estado = estado | binaop; 13 | 14 | cout << int(estado) << endl; 15 | 16 | return 0; 17 | } -------------------------------------------------------------------------------- /Labs/Lab07/Apoio/MaisChar.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab07/Apoio/MaisChar.cpp -------------------------------------------------------------------------------- /Labs/Lab07/Apoio/TestarBit.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() 5 | { 6 | cout << "Testar qual bit? "; 7 | int bit; 8 | cin >> bit; 9 | unsigned char binaop = 1 << bit; 10 | 11 | unsigned char estado = 240; 12 | if (estado & binaop) 13 | cout << "ligado" << endl; 14 | else 15 | cout << "desligado" << endl; 16 | 17 | return 0; 18 | } -------------------------------------------------------------------------------- /Labs/Lab07/Apoio/TipoChar.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab07/Apoio/TipoChar.cpp -------------------------------------------------------------------------------- /Labs/Lab07/Lab07.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab07/Lab07.pdf -------------------------------------------------------------------------------- /Labs/Lab07/Respostas/lab7q1.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | void asciiCode(int); 5 | 6 | int main() 7 | { 8 | asciiCode(80); 9 | asciiCode(114); 10 | asciiCode(111); 11 | asciiCode(103); 12 | asciiCode(67); 13 | asciiCode(111); 14 | asciiCode(109); 15 | asciiCode(112); 16 | cout << endl; 17 | 18 | return 0; 19 | } 20 | 21 | void asciiCode(int n) 22 | { 23 | char ch = n; 24 | cout << ch; 25 | } -------------------------------------------------------------------------------- /Labs/Lab07/Respostas/lab7q2.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | void beep(); 5 | int lerSenha(); 6 | 7 | int main() 8 | { 9 | cout << "Iniciando com um som..." << endl; 10 | beep(); 11 | cout << "Digite sua senha: ______\b\b\b\b\b\b"; 12 | int senha = lerSenha(); 13 | cout << "Obrigado!" << endl; 14 | 15 | return 0; 16 | } 17 | 18 | void beep() 19 | { 20 | cout << "\a"; 21 | } 22 | 23 | int lerSenha() 24 | { 25 | int temp; 26 | cin >> temp; 27 | return temp; 28 | } -------------------------------------------------------------------------------- /Labs/Lab07/Respostas/lab7q3.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | char charada (char, int); 5 | 6 | int main() 7 | { 8 | cout << charada('<', 20); 9 | cout << charada('\a' ,90); 10 | cout << charada('(', 72); 11 | cout << charada('5' ,48); 12 | cout << charada('\1', 107); 13 | cout << endl; 14 | 15 | return 0; 16 | } 17 | 18 | char charada (char ch, int x) 19 | { 20 | return ch + x; 21 | } -------------------------------------------------------------------------------- /Labs/Lab07/Respostas/lab7q4.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() 5 | { 6 | cout << "Maca = \t\t20 Unidades" << endl; 7 | cout << "Melancia = \t50 Unidades" << endl; 8 | cout << "Ameixa = \t30 Unidades" << endl; 9 | 10 | return 0; 11 | } -------------------------------------------------------------------------------- /Labs/Lab07/Respostas/lab7q5.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | unsigned char ligarBit(unsigned char, int); 5 | unsigned char desligarBit(unsigned char, int); 6 | bool testarBit(unsigned char, int); 7 | 8 | int main() 9 | { 10 | unsigned char ch = 1; 11 | 12 | cout << testarBit(ch, 7); 13 | cout << testarBit(ch, 6); 14 | cout << testarBit(ch, 5); 15 | cout << testarBit(ch, 4); 16 | cout << testarBit(ch, 3); 17 | cout << testarBit(ch, 2); 18 | cout << testarBit(ch, 1); 19 | cout << testarBit(ch, 0); 20 | cout << endl; 21 | 22 | ch = desligarBit(ch, 0); 23 | cout << testarBit(ch, 7); 24 | cout << testarBit(ch, 6); 25 | cout << testarBit(ch, 5); 26 | cout << testarBit(ch, 4); 27 | cout << testarBit(ch, 3); 28 | cout << testarBit(ch, 2); 29 | cout << testarBit(ch, 1); 30 | cout << testarBit(ch, 0); 31 | cout << endl; 32 | 33 | ch = ligarBit(ch, 0); 34 | cout << testarBit(ch, 7); 35 | cout << testarBit(ch, 6); 36 | cout << testarBit(ch, 5); 37 | cout << testarBit(ch, 4); 38 | cout << testarBit(ch, 3); 39 | cout << testarBit(ch, 2); 40 | cout << testarBit(ch, 1); 41 | cout << testarBit(ch, 0); 42 | cout << endl; 43 | 44 | return 0; 45 | } 46 | 47 | 48 | unsigned char ligarBit(unsigned char flag, int bit) 49 | { 50 | return flag | (1 << bit); 51 | } 52 | 53 | unsigned char desligarBit(unsigned char flag, int bit) 54 | { 55 | return flag & ~(1 << bit); 56 | } 57 | 58 | bool testarBit(unsigned char flag, int bit) 59 | { 60 | if (flag & (1 << bit)) 61 | return true; 62 | else 63 | return false; 64 | } -------------------------------------------------------------------------------- /Labs/Lab08/Apoio/Inexato.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() 5 | { 6 | float f = 6.1; 7 | cout << f << endl; 8 | 9 | cout << fixed; 10 | cout.precision(8); 11 | cout << "f = " << f << endl; 12 | 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /Labs/Lab08/Apoio/Limites.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | int main() 5 | { 6 | cout << "Numero de Digitos Significativos" << endl; 7 | cout << "float: " << FLT_DIG << endl; 8 | cout << "double: " << DBL_DIG << endl; 9 | cout << "long double: " << LDBL_DIG << endl; 10 | 11 | cout << "Valores Maximos do Expoente" << endl; 12 | cout << "float: " << FLT_MAX_10_EXP << endl; 13 | cout << "double: " << DBL_MAX_10_EXP << endl; 14 | cout << "long double: " << LDBL_MAX_10_EXP << endl; 15 | 16 | cout << "Numero de Bits na Mantissa" << endl; 17 | cout << "float: " << FLT_MANT_DIG << endl; 18 | cout << "double: " << DBL_MANT_DIG << endl; 19 | cout << "long double: " << LDBL_MANT_DIG << endl; 20 | 21 | return 0; 22 | } 23 | 24 | 25 | -------------------------------------------------------------------------------- /Labs/Lab08/Apoio/Precisao1.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab08/Apoio/Precisao1.cpp -------------------------------------------------------------------------------- /Labs/Lab08/Apoio/Precisao2.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() 5 | { 6 | float a = 2.34E+8; 7 | float b = a + 1.0f; 8 | 9 | cout << "a = " << a << endl; 10 | cout << "b - a = " << b - a << endl; 11 | 12 | return 0; 13 | } 14 | -------------------------------------------------------------------------------- /Labs/Lab08/Lab08.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab08/Lab08.pdf -------------------------------------------------------------------------------- /Labs/Lab08/Respostas/lab8q1.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab08/Respostas/lab8q1.cpp -------------------------------------------------------------------------------- /Labs/Lab08/Respostas/lab8q2.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() 5 | { 6 | cout << "Digite um ponto-flutuante: "; 7 | double num; 8 | cin >> num; 9 | 10 | cout << "Notacao padrao: " << num << endl; 11 | 12 | cout.setf(ios_base::scientific, ios_base::floatfield); 13 | cout << "Notacao cientifica: " << num << endl; 14 | 15 | cout.setf(ios_base::fixed, ios_base::floatfield); 16 | cout << "Notacao decimal: " << num << endl; 17 | 18 | return 0; 19 | } -------------------------------------------------------------------------------- /Labs/Lab08/Respostas/lab8q3.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | #define SegundosPorAno 3.156e7 5 | 6 | float anosParaSegundos(int); 7 | 8 | int main() 9 | { 10 | cout << "Digite sua idade em anos: "; 11 | int idade; 12 | cin >> idade; 13 | 14 | cout << idade << " anos correspondem a " << anosParaSegundos(idade) << " segundos." << endl; 15 | 16 | cout.setf(ios_base::fixed, ios_base::floatfield); 17 | cout.precision(1); 18 | 19 | cout << idade << " anos correspondem a " << anosParaSegundos(idade) << " segundos." << endl; 20 | 21 | return 0; 22 | } 23 | 24 | 25 | float anosParaSegundos(int anos) 26 | { 27 | return anos * SegundosPorAno; 28 | } -------------------------------------------------------------------------------- /Labs/Lab08/Respostas/lab8q4.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab08/Respostas/lab8q4.cpp -------------------------------------------------------------------------------- /Labs/Lab08/Respostas/lab8q5.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | 5 | int main() 6 | { 7 | float f1 = 24980154.845f; // extrapola o numero de digitos significativos da mantissa 8 | float f2 = 2e40f; // extrapola o maior expoente possivel 9 | 10 | double d1 = 293849384958473847.394; // extrapola o numero de digitos significativos da mantissa 11 | double d2 = 2e315; // extrapola o maior expoente possivel 12 | 13 | cout.setf(ios_base::fixed, ios_base::floatfield); 14 | 15 | cout << "f1 deveria ser 24980154.845 = " << f1 << endl; 16 | cout << "f2 deveria ser 2e40 = " << f2 << endl; 17 | cout << "d1 deveria ser 293849384958473847.394 = " << d1 << endl; 18 | cout << "d2 deveria ser 2e315 = " << d2 << endl; 19 | 20 | return 0; 21 | } -------------------------------------------------------------------------------- /Labs/Lab09/Apoio/ConvAtrib.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab09/Apoio/ConvAtrib.cpp -------------------------------------------------------------------------------- /Labs/Lab09/Apoio/ConvExpr.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() 5 | { 6 | long long a, b, c, d; 7 | 8 | a = 200903280945; 9 | b = 100000000 * 2009; 10 | c = 100000000LL * 2009; 11 | d = 10000000000 * 2009; 12 | 13 | cout << "a: " << a << endl; 14 | cout << "b: " << b << endl; 15 | cout << "c: " << c << endl; 16 | cout << "d: " << d << endl; 17 | 18 | return 0; 19 | } 20 | -------------------------------------------------------------------------------- /Labs/Lab09/Apoio/Divisao.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab09/Apoio/Divisao.cpp -------------------------------------------------------------------------------- /Labs/Lab09/Apoio/Modulo.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() 5 | { 6 | const int CentavosPorReal = 100; 7 | int valor; 8 | 9 | cout << "Digite um valor em centavos: "; 10 | cin >> valor; 11 | 12 | int reais = valor / CentavosPorReal; 13 | int centavos = valor % CentavosPorReal; 14 | 15 | cout << valor << " centavos correspondem a\n" << reais << " Reais e " 16 | << centavos << " centavos." << endl; 17 | 18 | return 0; 19 | } -------------------------------------------------------------------------------- /Labs/Lab09/Apoio/Operadores.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() 5 | { 6 | float num1, num2; 7 | 8 | cout << "Entre com um numero: "; 9 | cin >> num1; 10 | cout << "Entre com outro numero: "; 11 | cin >> num2; 12 | 13 | cout << "num1 = " << num1 << "; num2 = " << num2 << endl; 14 | cout << "num1 + num2 = " << num1 + num2 << endl; 15 | cout << "num1 - num2 = " << num1 - num2 << endl; 16 | cout << "num1 * num2 = " << num1 * num2 << endl; 17 | cout << "num1 / num2 = " << num1 / num2 << endl; 18 | 19 | return 0; 20 | } -------------------------------------------------------------------------------- /Labs/Lab09/Apoio/RandMod.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | 5 | int main() 6 | { 7 | cout << "Entre com os valores min e max:\n"; 8 | int min, max; 9 | cin >> min; 10 | cin >> max; 11 | 12 | cout << "Sorteando um valor nesta faixa:\n"; 13 | int sorteio = min + rand() % (max - min + 1); 14 | cout << sorteio << endl; 15 | } 16 | 17 | -------------------------------------------------------------------------------- /Labs/Lab09/Lab09.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab09/Lab09.pdf -------------------------------------------------------------------------------- /Labs/Lab09/Respostas/lab9q1.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() 5 | { 6 | double x1, x2; 7 | cout << "Digite o valor x1: "; 8 | cin >> x1; 9 | cout << "Digite o valor x2: "; 10 | cin >> x2; 11 | 12 | int val = int(x1) + int(x2); 13 | 14 | cout << "A adicao inteira dos valores = " << val << endl; 15 | 16 | return 0; 17 | } -------------------------------------------------------------------------------- /Labs/Lab09/Respostas/lab9q2.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab09/Respostas/lab9q2.cpp -------------------------------------------------------------------------------- /Labs/Lab09/Respostas/lab9q3.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() 5 | { 6 | const int HORASDIA = 24; 7 | const int MINHORAS = 60; 8 | const int SEGMIN = 60; 9 | 10 | cout << "Entre com o numero de segundos: "; 11 | 12 | int segundos; 13 | cin >> segundos; 14 | 15 | int dias, horas, min, seg; 16 | int resto; 17 | 18 | dias = segundos / (HORASDIA * MINHORAS * SEGMIN); 19 | resto = segundos % (HORASDIA * MINHORAS * SEGMIN); 20 | horas = resto / (MINHORAS * SEGMIN); 21 | resto = resto % (MINHORAS * SEGMIN); 22 | min = resto / SEGMIN; 23 | seg = resto % SEGMIN; 24 | 25 | cout << segundos << " segundos = " 26 | << dias << " dias, " 27 | << horas << " horas, " 28 | << min << " minutos e " 29 | << seg << " segundos.\n"; 30 | 31 | return 0; 32 | } -------------------------------------------------------------------------------- /Labs/Lab09/Respostas/lab9q4.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab09/Respostas/lab9q4.cpp -------------------------------------------------------------------------------- /Labs/Lab09/Respostas/lab9r1.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() 5 | { 6 | long a = 2009032809; 7 | float b = a; 8 | double c = a; 9 | 10 | cout << "valor long: " << a << endl; 11 | cout << endl; 12 | 13 | cout << "Mostrando em formato cientifico:" << endl; 14 | cout << "valor float: " << b << endl; 15 | cout << "valor double: " << c << endl; 16 | cout << endl; 17 | 18 | cout << "Mostrando no formato decimal:" << endl; 19 | cout << fixed; 20 | cout.precision(0); 21 | cout << "valor float: " << b << endl; 22 | cout << "valor double: " << c << endl; 23 | 24 | return 0; 25 | } 26 | -------------------------------------------------------------------------------- /Labs/Lab10/Apoio/ConstTam.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab10/Apoio/ConstTam.cpp -------------------------------------------------------------------------------- /Labs/Lab10/Apoio/NaoInicializado.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() 4 | { 5 | int v[3]; // cria vetor de 3 elementos 6 | 7 | cout << "Conteudo da posicao 0: " << v[0] << endl; 8 | cout << "Conteudo da posicao 1: " << v[1] << endl; 9 | cout << "Conteudo da posicao 2: " << v[2] << endl << endl; 10 | 11 | v[0] = 0; v[1] = 0; v[2] = 0; 12 | 13 | cout << "Conteudo da posicao 0: " << v[0] << endl; 14 | cout << "Conteudo da posicao 1: " << v[1] << endl; 15 | cout << "Conteudo da posicao 2: " << v[2] << endl; 16 | 17 | cout << "\nO vetor tem " << sizeof v << " bytes.\n"; 18 | cout << "Um elemento tem " << sizeof v[0] << " bytes.\n"; 19 | 20 | return 0; 21 | } 22 | -------------------------------------------------------------------------------- /Labs/Lab10/Apoio/SomaVetor.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int somaVetor(int[]); 5 | 6 | int main() 7 | { 8 | int batatas[3] = { 7, 8, 6 }; 9 | cout << "Total de batatas = "; 10 | cout << somaVetor(batatas) << endl; 11 | 12 | return 0; 13 | } 14 | 15 | int somaVetor(int vet[]) 16 | { 17 | return vet[0] + vet[1] + vet[2]; 18 | } -------------------------------------------------------------------------------- /Labs/Lab10/Apoio/Vetores.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab10/Apoio/Vetores.cpp -------------------------------------------------------------------------------- /Labs/Lab10/Lab10.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab10/Lab10.pdf -------------------------------------------------------------------------------- /Labs/Lab10/Respostas/lab10q1.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() 5 | { 6 | float preco[3] = {1.5f, 2.0f, 1.0f}; 7 | float quantidade[3]; 8 | 9 | // boas vindas 10 | cout << "Prezado Cliente," << endl; 11 | cout << endl; 12 | cout << "Digite a quantidade de quilos desejados:\n"; 13 | 14 | // entrada de dados 15 | cout << "Alface: "; 16 | cin >> quantidade[0]; 17 | cout << "Beterraba: "; 18 | cin >> quantidade[1]; 19 | cout << "Cenoura: "; 20 | cin >> quantidade[2]; 21 | cout << endl; 22 | 23 | // impressao do resumo 24 | cout << fixed; 25 | cout.precision(2); 26 | 27 | cout << "Resumo da Compra\n"; 28 | cout << "----------------------\n"; 29 | cout << "Alface: = R$" << quantidade[0] * preco[0] << endl; 30 | cout << "Beterraba = R$" << quantidade[1] * preco[1] << endl; 31 | cout << "Cenoura = R$" << quantidade[2] * preco[2] << endl; 32 | cout << "----------------------\n"; 33 | cout << "Total = R$" 34 | << quantidade[0] * preco[0] + 35 | quantidade[1] * preco[1] + 36 | quantidade[2] * preco[2] 37 | << endl; 38 | 39 | return 0; 40 | } -------------------------------------------------------------------------------- /Labs/Lab10/Respostas/lab10q2.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() 5 | { 6 | int vetA[5] = {10,20,30,40,50}; 7 | int vetB[5] = {10,20}; 8 | int vetC[5] = {0,0,30}; 9 | 10 | cout << "Vetor 1: " << vetA[0] << " " << vetA[1] << " " << vetA[2] << " " << vetA[3] << " " << vetA[4] << endl; 11 | cout << "Vetor 2: " << vetB[0] << " " << vetB[1] << " " << vetB[2] << " " << vetB[3] << " " << vetB[4] << endl; 12 | cout << "Vetor 3: " << vetC[0] << " " << vetC[1] << " " << vetC[2] << " " << vetC[3] << " " << vetC[4] << endl; 13 | 14 | return 0; 15 | } -------------------------------------------------------------------------------- /Labs/Lab10/Respostas/lab10q3.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int soma(int vet[]); 5 | 6 | int main() 7 | { 8 | cout << "Digite cinco valores: "; 9 | int val[5]; 10 | cin >> val[0] >> val[1] >> val[2] >> val[3] >> val[4]; 11 | 12 | cout << "A soma do vetor e " << soma(val) << "." << endl; 13 | 14 | return 0; 15 | } 16 | 17 | int soma(int vet[]) 18 | { 19 | return vet[0] + vet[1] + vet[2] + vet[3] + vet[4]; 20 | } 21 | -------------------------------------------------------------------------------- /Labs/Lab11/Apoio/AtribConcat.cpp: -------------------------------------------------------------------------------- 1 | #define _CRT_SECURE_NO_WARNINGS 2 | #include 3 | #include 4 | using namespace std; 5 | 6 | int main() 7 | { 8 | char vAnimal[20]; 9 | char vFelino[20] = "jaguar"; 10 | string sAnimal; 11 | string sFelino = "pantera"; 12 | 13 | strcpy(vAnimal, vFelino); // copia vetores de caracteres 14 | sAnimal = sFelino; // copia strings 15 | 16 | strcat(vAnimal, "ibe"); // adiciona "ibe" ao final do vetor 17 | sAnimal = sAnimal + " rosa"; // adiciona " rosa" ao final da string 18 | 19 | cout << vAnimal << " contem " << strlen(vAnimal) << " caracteres.\n"; 20 | cout << sAnimal << " contem " << sAnimal.size() << " caracteres.\n"; 21 | 22 | return 0; 23 | } 24 | -------------------------------------------------------------------------------- /Labs/Lab11/Apoio/Casa.cpp: -------------------------------------------------------------------------------- 1 | // misturando cin e cin.getline 2 | #include 3 | using namespace std; 4 | 5 | int main() 6 | { 7 | cout << "Em que ano sua casa foi construida?\n"; 8 | int ano; 9 | cin >> ano; 10 | 11 | cout << "Qual e seu endereco?\n"; 12 | char endereco[80]; 13 | cin.getline(endereco, 80); 14 | 15 | cout << "Ano de construcao: " << ano << endl; 16 | cout << "Endereco: " << endereco << "\n"; 17 | cout << "Pronto!\n"; 18 | 19 | return 0; 20 | } 21 | -------------------------------------------------------------------------------- /Labs/Lab11/Apoio/Comprimento.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | int main() 5 | { 6 | char vet[20]; 7 | string str; 8 | 9 | cout << "Comprimento de vet: " << strlen(vet) << endl; 10 | cout << "Comprimento de str: " << str.size() << endl; 11 | 12 | cout << "Entre com duas linhas de texto: " << endl; 13 | cin.getline(vet, 20); 14 | getline(cin, str); 15 | 16 | cout << "Comprimento de vet: " << strlen(vet) << endl; 17 | cout << "Comprimento de str: " << str.size() << endl; 18 | 19 | return 0; 20 | } -------------------------------------------------------------------------------- /Labs/Lab11/Apoio/Copiando.cpp: -------------------------------------------------------------------------------- 1 | #define _CRT_SECURE_NO_WARNINGS 2 | #include 3 | #include 4 | using namespace std; 5 | 6 | int main() 7 | { 8 | char felino[20] = "Tigre"; 9 | char animal[3]; 10 | 11 | strcpy(animal, felino); 12 | strcpy(felino, "Jaguar"); 13 | 14 | cout << "Felino: " << felino << endl; 15 | cout << "Animal: " << animal << endl; 16 | 17 | return 0; 18 | } 19 | -------------------------------------------------------------------------------- /Labs/Lab11/Apoio/Cowboy.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | 5 | int main() 6 | { 7 | const int Tam = 15; 8 | char nome[Tam]; // vetor "vazio" 9 | char apelido[Tam] = "C++owboy"; // vetor inicializado 10 | 11 | cout << "Ola! Eu sou " << apelido; 12 | cout << "! Qual e seu nome?\n"; 13 | cin >> nome; 14 | 15 | cout << "Bem, " << nome << ", seu nome tem "; 16 | cout << strlen(nome) << " letras e esta armazenado\n"; 17 | cout << "em um vetor de " << sizeof(nome) << " bytes.\n"; 18 | 19 | cout << "Sua inicial e " << nome[0] << ".\n"; 20 | apelido[3] = '\0'; // caractere nulo 21 | cout << "Meu apelido e " << apelido << endl; 22 | 23 | return 0; 24 | } 25 | -------------------------------------------------------------------------------- /Labs/Lab11/Apoio/Nome.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab11/Apoio/Nome.cpp -------------------------------------------------------------------------------- /Labs/Lab11/Apoio/Sobremesa.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() 5 | { 6 | const int TamVet = 20; 7 | char nome[TamVet]; 8 | char sobremesa[TamVet]; 9 | 10 | cout << "Entre com seu nome:\n"; 11 | cin.getline(nome, TamVet); 12 | 13 | cout << "Entre com sua sobremesa favorita:\n"; 14 | cin.getline(sobremesa, TamVet); 15 | 16 | cout << "Eu tenho um " << sobremesa; 17 | cout << " para voce, " << nome << ".\n"; 18 | 19 | return 0; 20 | } -------------------------------------------------------------------------------- /Labs/Lab11/Apoio/TipoString.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | 5 | int main() 6 | { 7 | char felino[20] = "jaguar"; 8 | string animal = "pantera"; 9 | 10 | cout << "Entre com o nome de dois felinos:\n"; 11 | cin >> felino; 12 | cin >> animal; 13 | 14 | cout << "Aqui estao os felinos:\n"; 15 | cout << felino << " e " << animal << endl; 16 | 17 | cout << "A terceira letra dos felinos:\n"; 18 | cout << felino[2] << " " << animal[2] << endl; 19 | 20 | return 0; 21 | } -------------------------------------------------------------------------------- /Labs/Lab11/Lab11.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab11/Lab11.pdf -------------------------------------------------------------------------------- /Labs/Lab11/Respostas/lab11q1.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | const int TamStr = 40; 5 | 6 | int main() 7 | { 8 | cout << "Primeiro nome: "; 9 | char nome[TamStr]; 10 | cin >> nome; 11 | 12 | cout << "Segundo nome: "; 13 | char sobrenome[TamStr]; 14 | cin >> sobrenome; 15 | 16 | cout << "Bom dia, " << nome << " " << sobrenome << ".\n"; 17 | cout << "Seja bem vindo " << nome[0] << sobrenome[0] << "!\n"; 18 | 19 | return 0; 20 | } -------------------------------------------------------------------------------- /Labs/Lab11/Respostas/lab11q2.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab11/Respostas/lab11q2.cpp -------------------------------------------------------------------------------- /Labs/Lab11/Respostas/lab11q3.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() 5 | { 6 | char vet[] = {'v','e','t','o','r'}; 7 | char str[] = {'s','t','r','i','n','g','\0'}; 8 | 9 | cout << str << endl; 10 | cout << vet << endl; 11 | 12 | return 0; 13 | } -------------------------------------------------------------------------------- /Labs/Lab11/Respostas/lab11q4.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() 5 | { 6 | char nome[] = "C++ Primer Plus"; 7 | 8 | cout << "A palavra e: " << nome << endl; 9 | cout << "Numero de caracteres: " << strlen(nome) << endl; 10 | cout << "Espaco ocupado em bytes: " << sizeof(nome) << endl; 11 | 12 | return 0; 13 | } -------------------------------------------------------------------------------- /Labs/Lab11/Respostas/lab11q5.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab11/Respostas/lab11q5.cpp -------------------------------------------------------------------------------- /Labs/Lab12/Apoio/IniReg.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab12/Apoio/IniReg.cpp -------------------------------------------------------------------------------- /Labs/Lab12/Apoio/SemNome.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab12/Apoio/SemNome.cpp -------------------------------------------------------------------------------- /Labs/Lab12/Apoio/VetReg.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | struct jogador 5 | { 6 | char nome[40]; 7 | float salario; 8 | unsigned gols; 9 | }; 10 | 11 | int main() 12 | { 13 | jogador equipe[22] = 14 | { 15 | { "Bebeto", 200000, 182 }, 16 | { "Romario", 300000, 178 } 17 | }; 18 | 19 | cout << "Contracoes para o proximo ano: " << equipe[0].nome << " e " << equipe[1].nome << "!\n"; 20 | cout << "Preco da aquisicao: R$" << equipe[0].salario + equipe[1].salario << "!\n"; 21 | 22 | return 0; 23 | } 24 | -------------------------------------------------------------------------------- /Labs/Lab12/Lab12.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab12/Lab12.pdf -------------------------------------------------------------------------------- /Labs/Lab12/Respostas/lab12q1.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | struct chocolate 5 | { 6 | char marca[25]; 7 | float peso; 8 | int calorias; 9 | }; 10 | 11 | int main() 12 | { 13 | chocolate lanche = {"Charge", 2.3, 350}; 14 | 15 | cout << lanche.marca << endl; 16 | cout << lanche.peso << endl; 17 | cout << lanche.calorias << endl; 18 | 19 | return 0; 20 | } -------------------------------------------------------------------------------- /Labs/Lab12/Respostas/lab12q2.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | struct chocolate 5 | { 6 | char marca[25]; 7 | float peso; 8 | int calorias; 9 | }; 10 | 11 | int main() 12 | { 13 | chocolate vet[3] = 14 | { 15 | {"Prestigio", 170.0f, 300}, 16 | {"Charge", 175.0f, 400}, 17 | {"Choquito", 160.0f, 320} 18 | }; 19 | 20 | cout << vet[0].marca << " " << vet[0].peso << " " << vet[0].calorias << endl; 21 | cout << vet[1].marca << " " << vet[1].peso << " " << vet[1].calorias << endl; 22 | cout << vet[2].marca << " " << vet[2].peso << " " << vet[2].calorias << endl; 23 | 24 | return 0; 25 | } -------------------------------------------------------------------------------- /Labs/Lab12/Respostas/lab12q3.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using std::cin; 3 | using std::cout; 4 | using std::endl; 5 | 6 | // não foi usado "using namespace std;" porque o espaço de nomes std 7 | // já contém um elemento de nome "data", o que causaria um choque 8 | // com o tipo "data" definido no programa 9 | 10 | struct data 11 | { 12 | short dia; 13 | short mes; 14 | short ano; 15 | }; 16 | 17 | int DiasDeVida(data, data); 18 | 19 | int main() 20 | { 21 | data nasc, hoje; // data no formato DD/MM/AAAA 22 | char separador; 23 | 24 | cout << "Data de nascimento: "; 25 | cin >> nasc.dia >> separador >> nasc.mes >> separador >> nasc.ano; 26 | 27 | cout << "Data de hoje: "; 28 | cin >> hoje.dia >> separador >> hoje.mes >> separador >> hoje.ano; 29 | 30 | cout << "Voce tem " << DiasDeVida(nasc, hoje) << " dias de vida." << endl; 31 | 32 | return 0; 33 | } 34 | 35 | int DiasDeVida(data nasc, data hoje) 36 | { 37 | const int DiasPorMes = 31; 38 | const int DiasPorAno = 31 * 12; 39 | 40 | // Na data 05/02/2010, temos 1 (um) mês completo e mais 5 dias em 2010 41 | // Essa é a justificativa para subtrair 1 do valor do mês 42 | int ini = (nasc.ano * DiasPorAno) + ((nasc.mes - 1) * DiasPorMes) + nasc.dia; 43 | int fim = (hoje.ano * DiasPorAno) + ((hoje.mes - 1) * DiasPorMes) + hoje.dia; 44 | 45 | return fim - ini; 46 | } 47 | -------------------------------------------------------------------------------- /Labs/Lab12/Respostas/lab12q4.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab12/Respostas/lab12q4.cpp -------------------------------------------------------------------------------- /Labs/Lab12/Respostas/lab12r2.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab12/Respostas/lab12r2.cpp -------------------------------------------------------------------------------- /Labs/Lab13/Apoio/Baby.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | 5 | enum Sexo { Masculino, Feminino }; 6 | 7 | int main() 8 | { 9 | cout << "Sorteando o sexo do bebe...\n"; 10 | random_device rand; 11 | unsigned sorteio = rand() % 2; 12 | 13 | if (sorteio == Masculino) 14 | cout << "Parabens, um menino!\n"; 15 | if (sorteio == Feminino) 16 | cout << "Parabens, uma menina!\n"; 17 | 18 | return 0; 19 | } 20 | -------------------------------------------------------------------------------- /Labs/Lab13/Apoio/CharInt.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | union CharInt 5 | { 6 | short num; 7 | char ch; 8 | }; 9 | 10 | int main() 11 | { 12 | CharInt val = {0}; 13 | 14 | cout << "Digite um caractere: "; 15 | cin >> val.ch; 16 | 17 | cout << "Codigo ASCII: "; 18 | cout << val.num << endl; 19 | 20 | return 0; 21 | } 22 | -------------------------------------------------------------------------------- /Labs/Lab13/Apoio/Meses.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab13/Apoio/Meses.cpp -------------------------------------------------------------------------------- /Labs/Lab13/Apoio/RegKey.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | union regkey { 5 | int chave; 6 | char codigo[8]; 7 | }; 8 | 9 | int main() 10 | { 11 | cout << "Qual seu tipo de senha?\n[1] chave\n[2] codigo\nOpcao: "; 12 | int tipo; 13 | cin >> tipo; 14 | 15 | regkey senha; 16 | 17 | if (tipo == 1) 18 | { 19 | cout << "Digite sua chave: "; 20 | cin >> senha.chave; 21 | } 22 | else 23 | { 24 | cout << "Digite seu codigo: "; 25 | cin >> senha.codigo; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Labs/Lab13/Lab13.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab13/Lab13.pdf -------------------------------------------------------------------------------- /Labs/Lab13/Respostas/lab13q1.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | union CorAuto 5 | { 6 | char nome[10]; 7 | int num; 8 | char codigo[5]; 9 | }; 10 | 11 | struct Automovel 12 | { 13 | char modelo[15]; 14 | unsigned ano; 15 | CorAuto cor; 16 | float preco; 17 | }; 18 | 19 | int main() 20 | { 21 | Automovel garagem[10] = 22 | { 23 | {"Vectra", 2009, "Azul", 58000}, 24 | {"Polo", 2008, "Preto", 45000} 25 | }; 26 | 27 | // entrada de dados do usuario 28 | cout << "Digite os dados do carro\n"; 29 | cout << "Modelo: "; 30 | cin >> garagem[2].modelo; 31 | cout << "Ano: "; 32 | cin >> garagem[2].ano; 33 | cout << "Cor (codigo): "; 34 | cin >> garagem[2].cor.codigo; 35 | cout << "Preco: "; 36 | cin >> garagem[2].preco; 37 | 38 | // impressao dos valores do vetor 39 | cout << "\nCarros em Estoque\n"; 40 | cout << "-----------------\n"; 41 | cout << garagem[0].modelo << "\t"; 42 | cout << garagem[0].ano << "\t"; 43 | cout << garagem[0].cor.nome << "\t"; 44 | cout << garagem[0].preco << endl; 45 | 46 | cout << garagem[1].modelo << "\t"; 47 | cout << garagem[1].ano << "\t"; 48 | cout << garagem[1].cor.nome << "\t"; 49 | cout << garagem[1].preco << endl; 50 | 51 | cout << garagem[2].modelo << "\t"; 52 | cout << garagem[2].ano << "\t"; 53 | cout << garagem[2].cor.codigo << "\t"; 54 | cout << garagem[2].preco << endl; 55 | 56 | return 0; 57 | } -------------------------------------------------------------------------------- /Labs/Lab13/Respostas/lab13q2.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab13/Respostas/lab13q2.cpp -------------------------------------------------------------------------------- /Labs/Lab14/Apoio/Apontador.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab14/Apoio/Apontador.cpp -------------------------------------------------------------------------------- /Labs/Lab14/Apoio/Endereco.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab14/Apoio/Endereco.cpp -------------------------------------------------------------------------------- /Labs/Lab14/Apoio/Estrela.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | struct jogador { 5 | char nome[40]; 6 | float salario; 7 | unsigned gols; 8 | }; 9 | 10 | int main() 11 | { 12 | jogador time[22]; 13 | jogador * estrela = &time[0]; 14 | 15 | cout << "Digite o nome, salario e gols de dois jogadores: "; 16 | cin >> time[0].nome; cin >> time[0].salario; cin >> time[0].gols; 17 | cin >> time[1].nome; cin >> time[1].salario; cin >> time[1].gols; 18 | 19 | cout << "\nO jogador estrela do time e " << estrela->nome << "!\n"; 20 | 21 | return 0; 22 | } 23 | -------------------------------------------------------------------------------- /Labs/Lab14/Apoio/StringPtr.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab14/Apoio/StringPtr.cpp -------------------------------------------------------------------------------- /Labs/Lab14/Lab14.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab14/Lab14.pdf -------------------------------------------------------------------------------- /Labs/Lab14/Respostas/lab14q1.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab14/Respostas/lab14q1.cpp -------------------------------------------------------------------------------- /Labs/Lab14/Respostas/lab14q2.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() 5 | { 6 | char letra = 'A'; 7 | char * ptr = &letra; 8 | *ptr = 'B'; 9 | 10 | cout << *ptr << endl; 11 | cout << letra << endl; 12 | } 13 | -------------------------------------------------------------------------------- /Labs/Lab14/Respostas/lab14q3.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | void Mais(int * pnum) 5 | { 6 | *pnum = *pnum + 1; 7 | } 8 | 9 | int Incrementa(int num) 10 | { 11 | num = num + 1; 12 | return num; 13 | } 14 | 15 | int main() 16 | { 17 | cout << "Digite um valor: "; 18 | int valor; 19 | cin >> valor; 20 | 21 | Mais(&valor); 22 | cout << "Resultado apos Mais: " << valor << endl; 23 | 24 | valor = Incrementa(valor); 25 | cout << "Resultado apos Incrementa: " << valor << endl; 26 | } -------------------------------------------------------------------------------- /Labs/Lab14/Respostas/lab14q4.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | union Color 5 | { 6 | struct 7 | { 8 | unsigned char a; 9 | unsigned char b; 10 | unsigned char g; 11 | unsigned char r; 12 | } rgba; 13 | 14 | unsigned coded; 15 | }; 16 | 17 | void ReadRGBA(Color * pcolor); 18 | void ReadInt32(Color * pcolor); 19 | void ShowColor(Color * pcolor, bool type); 20 | 21 | int main() 22 | { 23 | cout << "Digite uma cor no formato\n"; 24 | cout << "RGBA: "; 25 | Color frente; 26 | ReadRGBA(&frente); 27 | 28 | cout << "Int32: "; 29 | Color fundo; 30 | ReadInt32(&fundo); 31 | 32 | cout << "\nExibindo as cores em formatos invertidos:\n"; 33 | ShowColor(&frente, false); 34 | ShowColor(&fundo, true); 35 | } 36 | 37 | void ReadRGBA(Color * pcolor) 38 | { 39 | short r, g, b, a; 40 | cin >> r >> g >> b >> a; 41 | 42 | pcolor->rgba.r = unsigned char(r); 43 | pcolor->rgba.g = unsigned char(g); 44 | pcolor->rgba.b = unsigned char(b); 45 | pcolor->rgba.a = unsigned char(a); 46 | } 47 | 48 | void ReadInt32(Color * pcolor) 49 | { 50 | cin >> pcolor->coded; 51 | } 52 | 53 | void ShowColor(Color * pcolor, bool type) 54 | { 55 | if (type == true) 56 | { 57 | cout << "RGBA(" 58 | << int(pcolor->rgba.r) << "," 59 | << int(pcolor->rgba.g) << "," 60 | << int(pcolor->rgba.b) << "," 61 | << int(pcolor->rgba.a) << ")" 62 | << endl; 63 | } 64 | else 65 | { 66 | cout << pcolor->coded << endl; 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /Labs/Lab15/Apoio/NewSize.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab15/Apoio/NewSize.cpp -------------------------------------------------------------------------------- /Labs/Lab15/Apoio/RegDin.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab15/Apoio/RegDin.cpp -------------------------------------------------------------------------------- /Labs/Lab15/Apoio/Triplo.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab15/Apoio/Triplo.cpp -------------------------------------------------------------------------------- /Labs/Lab15/Apoio/VetDin.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | struct jogador 5 | { 6 | char nome[40]; 7 | float salario; 8 | unsigned gols; 9 | }; 10 | 11 | int main() 12 | { 13 | jogador * ptime = new jogador[22]; 14 | 15 | cout << "Digite o nome, salario e gols de dois jogadores:\n"; 16 | cin >> ptime[0].nome; cin >> ptime[0].salario; cin >> ptime[0].gols; 17 | cin >> ptime[1].nome; cin >> ptime[1].salario; cin >> ptime[1].gols; 18 | 19 | cout << "Custo da aquisicao: R$" << ptime[0].salario + ptime[1].salario << "!\n"; 20 | 21 | delete[] ptime; 22 | } -------------------------------------------------------------------------------- /Labs/Lab15/Lab15.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab15/Lab15.pdf -------------------------------------------------------------------------------- /Labs/Lab15/Respostas/lab15q1.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() 5 | { 6 | cout << "Digite o numero de alunos (minimo 2): "; 7 | int numAlunos; 8 | cin >> numAlunos; 9 | 10 | float * vet = new float[numAlunos]; 11 | 12 | cout << "Digite a nota de dois alunos:\n"; 13 | cin >> vet[0] >> vet[1]; 14 | 15 | cout << "As notas digitadas foram " << vet[0] << " e " << vet[1] << endl; 16 | 17 | delete[] vet; 18 | 19 | return 0; 20 | } -------------------------------------------------------------------------------- /Labs/Lab15/Respostas/lab15q2.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | struct balao 5 | { 6 | float diametro; 7 | char marca[20]; 8 | int modelo; 9 | }; 10 | 11 | int main() 12 | { 13 | balao * ptbal = new balao; 14 | 15 | cout << "Entre com o diametro: "; 16 | cin >> ptbal->diametro; 17 | cout << "Entre com a marca: "; 18 | cin >> ptbal->marca; 19 | cout << "Entre com o modelo: "; 20 | cin >> ptbal->modelo; 21 | 22 | cout << endl; 23 | cout << "O balao inserido foi: "; 24 | cout << ptbal->modelo << " " << ptbal->diametro << " " << ptbal->marca << endl; 25 | 26 | delete ptbal; 27 | 28 | return 0; 29 | } -------------------------------------------------------------------------------- /Labs/Lab15/Respostas/lab15q3.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab15/Respostas/lab15q3.cpp -------------------------------------------------------------------------------- /Labs/Lab15/Respostas/lab15q4.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | struct Automovel 5 | { 6 | char modelo[20]; 7 | int ano; 8 | float preco; 9 | }; 10 | 11 | void ImprimirTotal(Automovel * autos); 12 | 13 | int main() 14 | { 15 | Automovel * ptvet = new Automovel[10]; 16 | 17 | cout << "Carro #1\n"; 18 | cout << "Modelo: "; 19 | cin >> ptvet[0].modelo; 20 | cout << "Ano: "; 21 | cin >> ptvet[0].ano; 22 | cout << "Preco: "; 23 | cin >> ptvet[0].preco; 24 | 25 | cout << "Carro #2\n"; 26 | cout << "Modelo: "; 27 | cin >> ptvet[1].modelo; 28 | cout << "Ano: "; 29 | cin >> ptvet[1].ano; 30 | cout << "Preco: "; 31 | cin >> ptvet[1].preco; 32 | 33 | cout << "\nO preco total dos carros: "; 34 | ImprimirTotal(ptvet); 35 | 36 | delete [] ptvet; 37 | return 0; 38 | } 39 | 40 | void ImprimirTotal(Automovel * autos) 41 | { 42 | cout << autos[0].preco + autos[1].preco << endl; 43 | } -------------------------------------------------------------------------------- /Labs/Lab15/Respostas/lab15q5.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab15/Respostas/lab15q5.cpp -------------------------------------------------------------------------------- /Labs/Lab16/Apoio/Crescente.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab16/Apoio/Crescente.cpp -------------------------------------------------------------------------------- /Labs/Lab16/Apoio/Fatorial.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab16/Apoio/Fatorial.cpp -------------------------------------------------------------------------------- /Labs/Lab16/Apoio/Inverte.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab16/Apoio/Inverte.cpp -------------------------------------------------------------------------------- /Labs/Lab16/Apoio/Limite.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab16/Apoio/Limite.cpp -------------------------------------------------------------------------------- /Labs/Lab16/Apoio/Repetir.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() 5 | { 6 | 7 | int i; // cria um contador 8 | 9 | // inicializa; testa; atualiza 10 | for (i = 0; i < 5; i++) 11 | cout << "C++ sabe repetir." << endl; 12 | cout << "C++ sabe quando parar." << endl; 13 | 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /Labs/Lab16/Apoio/ValorExpr.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() 4 | { 5 | int x; 6 | 7 | cout << "A expressao x = 100 tem o valor "; 8 | cout << (x = 100) << endl; 9 | cout << "Agora x = " << x << endl; 10 | cout << "A expressao x < 3 tem o valor "; 11 | cout << (x < 3) << endl; 12 | cout << "A expressao x > 3 tem o valor "; 13 | cout << (x > 3) << endl; 14 | 15 | // cout.setf(ios_base::boolalpha); 16 | cout << boolalpha; 17 | cout << "A expressao x < 3 tem o valor "; 18 | cout << (x < 3) << endl; 19 | cout << "A expressao x > 3 tem o valor "; 20 | cout << (x > 3) << endl; 21 | 22 | return 0; 23 | } -------------------------------------------------------------------------------- /Labs/Lab16/Lab16.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab16/Lab16.pdf -------------------------------------------------------------------------------- /Labs/Lab16/Respostas/lab16q1.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() 5 | { 6 | const char * mes[12] = 7 | { 8 | "Janeiro", 9 | "Fevereiro", 10 | "Marco", 11 | "Abril", 12 | "Maio", 13 | "Junho", 14 | "Julho", 15 | "Agosto", 16 | "Setembro", 17 | "Outubro", 18 | "Novembro", 19 | "Dezembro" 20 | }; 21 | 22 | unsigned vendas[12]; 23 | unsigned total = 0; 24 | 25 | cout << "Digite o numero de livros vendidos\n"; 26 | 27 | for (int i=0; i < 12; i++) 28 | { 29 | cout << mes[i] << ": "; 30 | cin >> vendas[i]; 31 | total += vendas[i]; 32 | } 33 | 34 | cout << "Em um ano foram vendidos " << total << " livros.\n"; 35 | 36 | return 0; 37 | } -------------------------------------------------------------------------------- /Labs/Lab16/Respostas/lab16q2.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | struct Carro 5 | { 6 | char fabricante[20]; 7 | int ano; 8 | }; 9 | 10 | int main() 11 | { 12 | cout << "Quantos carros para catalogar? "; 13 | int num; 14 | cin >> num; 15 | 16 | Carro * vet = new Carro[num]; 17 | 18 | for(int i=0; i < num; i++) 19 | { 20 | cout << "Carro #" << i+1 << ":\n"; 21 | cout << "Entre com a marca: "; 22 | cin >> vet[i].fabricante; 23 | cout << "Entre com o ano de fabricacao: "; 24 | cin >> vet[i].ano; 25 | } 26 | 27 | cout << "\nAqui esta sua colecao:\n"; 28 | for (int i=0; i < num; i++) 29 | cout << vet[i].ano << " " << vet[i].fabricante << endl; 30 | 31 | delete [] vet; 32 | 33 | return 0; 34 | } -------------------------------------------------------------------------------- /Labs/Lab17/Apoio/Acumulo.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() 5 | { 6 | cout << "Entre com cinco valores:\n"; 7 | double numero; 8 | double soma = 0.0; 9 | for (int i = 1; i <= 5; i++) 10 | { 11 | cout << "Valor " << i << ": "; 12 | cin >> numero; 13 | soma += numero; // soma = soma + numero; 14 | } 15 | cout << "A soma = " << soma << "\n"; 16 | cout << "A media = " << soma / 5 << "\n"; 17 | 18 | return 0; 19 | } -------------------------------------------------------------------------------- /Labs/Lab17/Apoio/Aninhados.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() 5 | { 6 | cout << "Tabuada do Vezes\n\n"; 7 | 8 | for (int i = 1; i <= 10; ++i) 9 | { 10 | for (int j = 1; j <= 10; ++j) 11 | cout << i << " x " << j << " = " << i * j << "\n"; 12 | cout << endl; 13 | } 14 | 15 | return 0; 16 | } -------------------------------------------------------------------------------- /Labs/Lab17/Apoio/Incremento.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() 5 | { 6 | int a = 20; 7 | int b = 20; 8 | 9 | cout << " a = " << a << ": b = " << b << "\n"; 10 | cout << "++a = " << ++a << ": b++ = " << b++ << "\n"; 11 | cout << " a = " << a << ": b = " << b << "\n"; 12 | 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /Labs/Lab17/Apoio/Invertido.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | 5 | int main() 6 | { 7 | cout << "Entre com uma palavra: "; 8 | char palavra[20]; 9 | cin >> palavra; 10 | 11 | // mostra as letras na ordem inversa 12 | for (int i = strlen(palavra) - 1; i >= 0; i--) 13 | cout << palavra[i]; 14 | cout << "\nTchau.\n"; 15 | 16 | return 0; 17 | } 18 | -------------------------------------------------------------------------------- /Labs/Lab17/Apoio/Modifica.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | 5 | int main() 6 | { 7 | cout << "Entre com uma palavra: "; 8 | char palavra[20]; 9 | cin >> palavra; 10 | 11 | // inverte string, modificando a string original 12 | char temp; 13 | int i, j; 14 | for (j = 0, i = strlen(palavra) - 1; j < i; --i, ++j) 15 | { 16 | temp = palavra[i]; 17 | palavra[i] = palavra[j]; 18 | palavra[j] = temp; 19 | } 20 | cout << palavra << "\nPronto.\n"; 21 | 22 | return 0; 23 | } 24 | -------------------------------------------------------------------------------- /Labs/Lab17/Apoio/Passo.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() 5 | { 6 | cout << "Entre com um valor inteiro: "; 7 | int passo; 8 | cin >> passo; 9 | 10 | cout << "Contando de " << passo << " em " << passo << ":\n"; 11 | 12 | for (int i = 0; i < 100; i = i + passo) 13 | cout << i << endl; 14 | 15 | return 0; 16 | } -------------------------------------------------------------------------------- /Labs/Lab17/Lab17.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab17/Lab17.pdf -------------------------------------------------------------------------------- /Labs/Lab17/Respostas/lab17q1.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() 5 | { 6 | for (int i = 0; i < 5; i++) 7 | { 8 | for (int j = 0; j < i+1; j++) 9 | cout << "*"; 10 | cout << endl; 11 | } 12 | 13 | for (int i = 0; i < 4; i++) 14 | { 15 | for (int j = 0; j < 4-i; j++) 16 | cout << "*"; 17 | cout << endl; 18 | } 19 | 20 | return 0; 21 | } -------------------------------------------------------------------------------- /Labs/Lab17/Respostas/lab17q2 .cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() 5 | { 6 | cout << "Entre com o numero de linhas: "; 7 | int linhas; 8 | cin >> linhas; 9 | 10 | for (int i = 1; i <= linhas; i++) 11 | { 12 | for (int j = 1; j <= (linhas-i); j++) 13 | { 14 | cout << "."; 15 | } 16 | for (int j = 1; j <= i; j++) 17 | { 18 | cout << "*"; 19 | } 20 | cout << endl; 21 | } 22 | 23 | return 0; 24 | } -------------------------------------------------------------------------------- /Labs/Lab17/Respostas/lab17q3.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() 5 | { 6 | cout << "Digite uma palavra: "; 7 | char palavra[20]; 8 | cin >> palavra; 9 | 10 | char invertida[20]; 11 | int tam = strlen(palavra); 12 | for (int i=0; i < tam; i++) 13 | invertida[i] = palavra[tam-i-1]; 14 | 15 | invertida[tam] = '\0'; 16 | 17 | cout << "Palavra invertida: " << invertida << endl; 18 | 19 | if (strcmp(palavra, invertida)) 20 | cout << "A palavra nao e um palindromo\n"; 21 | else 22 | cout << "A palavra e um palindromo\n"; 23 | 24 | return 0; 25 | } -------------------------------------------------------------------------------- /Labs/Lab18/Apoio/Favorito.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() 5 | { 6 | int n; 7 | cout << "Digite um numero entre 0-10\n"; 8 | 9 | do 10 | { 11 | cin >> n; 12 | } while (n != 7); 13 | 14 | cout << "Sim, 7 e meu numero favorito.\n"; 15 | 16 | return 0; 17 | } -------------------------------------------------------------------------------- /Labs/Lab18/Apoio/FloatCmp.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() 5 | { 6 | float a = 6.9f; 7 | float b = 0.9f; 8 | 9 | cout << boolalpha << (a - int(a) == b) << endl; 10 | 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /Labs/Lab18/Apoio/Infinito.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() 5 | { 6 | int nota[5] = { 10, 10, 10, 9, 7 }; 7 | 8 | cout << "Fazendo da maneira certa:\n"; 9 | int i; 10 | for (i = 0; nota[i] == 10; i++) 11 | cout << "Nota " << i << " e um 10\n"; 12 | 13 | cout << "Fazendo da forma errada:\n"; 14 | for (i = 0; nota[i] = 10; i++) 15 | cout << "Nota " << i << " e um 10\n"; 16 | 17 | return 0; 18 | } -------------------------------------------------------------------------------- /Labs/Lab18/Apoio/Moleque.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab18/Apoio/Moleque.cpp -------------------------------------------------------------------------------- /Labs/Lab18/Apoio/SomaNums.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab18/Apoio/SomaNums.cpp -------------------------------------------------------------------------------- /Labs/Lab18/Apoio/Vertical.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab18/Apoio/Vertical.cpp -------------------------------------------------------------------------------- /Labs/Lab18/Lab18.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab18/Lab18.pdf -------------------------------------------------------------------------------- /Labs/Lab18/Respostas/lab18q1.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() 5 | { 6 | cout << "Digite numeros (zero para encerrar):\n"; 7 | int num; 8 | int soma = 0; 9 | 10 | do 11 | { 12 | cin >> num; 13 | soma += num; 14 | cout << "Soma parcial: " << soma << endl; 15 | 16 | } while (num != 0); 17 | 18 | 19 | return 0; 20 | } -------------------------------------------------------------------------------- /Labs/Lab18/Respostas/lab18q2.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() 5 | { 6 | 7 | int num; 8 | int quant = 0; 9 | float soma = 0; 10 | 11 | cout << "Digite valores inteiros (0 para sair):\n"; 12 | cin >> num; 13 | while (num != 0) 14 | { 15 | quant++; 16 | soma += num; 17 | cin >> num; 18 | } 19 | 20 | cout << "Quantidade = " << quant << ", media = " << soma/quant << endl; 21 | 22 | return 0; 23 | } -------------------------------------------------------------------------------- /Labs/Lab18/Respostas/lab18q3.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() 5 | { 6 | double daiane = 100; 7 | double celia = 100; 8 | int anos = 0; 9 | 10 | while (celia <= daiane) 11 | { 12 | daiane += 10; 13 | celia += 0.05 * celia; 14 | ++anos; 15 | } 16 | 17 | cout << fixed; 18 | cout.precision(2); 19 | 20 | cout << "Se passaram " << anos << " anos para os saldos atingirem os valores" << endl; 21 | cout << "Daiane: " << daiane << endl; 22 | cout << "Celia : " << celia << endl; 23 | 24 | return 0; 25 | } -------------------------------------------------------------------------------- /Labs/Lab19/Apoio/Matriz.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab19/Apoio/Matriz.cpp -------------------------------------------------------------------------------- /Labs/Lab19/Apoio/MaxTemp.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | const int Cids = 4; 5 | const int Anos = 5; 6 | 7 | int main() 8 | { 9 | 10 | const char * cidades[Cids] = 11 | { "Mossoro", "Caraubas", "Angicos", "Pau dos Ferros" }; 12 | 13 | int maxtemp[Cids][Anos] = 14 | { 15 | { 35, 28, 25, 20, 24 }, // valores para maxtemp[0] 16 | { 15, 19, 23, 35, 32 }, // valores para maxtemp[1] 17 | { 34, 36, 30, 31, 30 }, // valores para maxtemp[2] 18 | { 31, 36, 38, 32, 26 } // valores para maxtemp[3] 19 | }; 20 | 21 | cout << "Temperaturas maximas dos ultimos anos:\n\n"; 22 | 23 | for (int i = 0; i < Cids; ++i) 24 | { 25 | cout << cidades[i] << ":\t"; 26 | for (int j = 0; j < Anos; ++j) 27 | cout << maxtemp[i][j] << "\t"; 28 | cout << endl; 29 | } 30 | 31 | system("pause"); 32 | return 0; 33 | } 34 | -------------------------------------------------------------------------------- /Labs/Lab19/Apoio/Repete1.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab19/Apoio/Repete1.cpp -------------------------------------------------------------------------------- /Labs/Lab19/Apoio/Repete2.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab19/Apoio/Repete2.cpp -------------------------------------------------------------------------------- /Labs/Lab19/Apoio/Repete3.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab19/Apoio/Repete3.cpp -------------------------------------------------------------------------------- /Labs/Lab19/Apoio/Vetor2D.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab19/Apoio/Vetor2D.cpp -------------------------------------------------------------------------------- /Labs/Lab19/Lab19.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab19/Lab19.pdf -------------------------------------------------------------------------------- /Labs/Lab19/Respostas/lab19q1.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() 5 | { 6 | int matriz[5][5] = 7 | { 8 | {38,51,50,56,98}, 9 | {17,65,25,62,54}, 10 | {23,23,64,45,92}, 11 | {41,39,19,68,87}, 12 | {65,10,12,22,13} 13 | }; 14 | 15 | int soma = 0; 16 | 17 | for (int i=0; i < 5; i++) 18 | for (int j=0; j < 5; j++) 19 | soma += matriz[i][j]; 20 | 21 | cout << "Media: " << soma / 25.0f << endl; 22 | 23 | return 0; 24 | } -------------------------------------------------------------------------------- /Labs/Lab19/Respostas/lab19q2.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() 5 | { 6 | int n[10] = {0,1,0,0,1,0,1,1,1,1}; 7 | 8 | float resultado = 0; 9 | 10 | for (int i=0; i <= 9; i++) 11 | resultado += n[i]; 12 | 13 | cout << "Resultado: " << resultado << endl; 14 | 15 | return 0; 16 | } -------------------------------------------------------------------------------- /Labs/Lab19/Respostas/lab19q3.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() 5 | { 6 | const int Linhas = 5; 7 | 8 | for (int i= 0; i < Linhas; i++) 9 | { 10 | for (int j=i; j < 4; j++) 11 | cout << ' '; 12 | 13 | for (int j=0; j < i; j++) 14 | cout << '$'; 15 | 16 | cout << '$'; 17 | 18 | for (int j=0; j < i; j++) 19 | cout << '$'; 20 | 21 | for (int j=i; j < 4; j++) 22 | cout << ' '; 23 | 24 | cout << endl; 25 | } 26 | 27 | return 0; 28 | } -------------------------------------------------------------------------------- /Labs/Lab19/Respostas/lab19q4.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | void linha(char c); 5 | 6 | int main() 7 | { 8 | cout << "Digite um caractere: "; 9 | char ch; 10 | cin >> ch; 11 | 12 | cout << endl; 13 | 14 | linha(ch); 15 | cout << "Programando em C++" << endl; 16 | linha(ch); 17 | 18 | return 0; 19 | } 20 | 21 | void linha(char c) 22 | { 23 | for (int i=0; i < 20; i++) 24 | cout << c; 25 | cout << endl; 26 | } -------------------------------------------------------------------------------- /Labs/Lab20/Apoio/Advinhacao.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | const int Fav = 27; 4 | int main() 5 | { 6 | int n; 7 | cout << "Digite um numero entre 0 e 100 para "; 8 | cout << "descobrir meu favorito: "; 9 | do 10 | { 11 | cin >> n; 12 | if (n < Fav) 13 | cout << "Muito baixo, tente novamente: "; 14 | else if (n > Fav) 15 | cout << "Muito alto, tente novamente: "; 16 | else 17 | cout << Fav << " e o meu favorito!\n"; 18 | } while (n != Fav); 19 | 20 | return 0; 21 | } 22 | -------------------------------------------------------------------------------- /Labs/Lab20/Apoio/Confusao.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() 4 | { 5 | char ch; 6 | cout << "Digite, que eu repito.\n"; 7 | 8 | cin.get(ch); 9 | while (ch != '.') // encerra no final da frase 10 | { 11 | if (ch == '\n') 12 | cout << ch; // imprime a nova linha 13 | else 14 | cout << ++ch; // imprime outro caractere 15 | cin.get(ch); 16 | } 17 | 18 | cout << "\nPor favor desculpe a confusao.\n"; 19 | 20 | return 0; 21 | } 22 | -------------------------------------------------------------------------------- /Labs/Lab20/Apoio/Espacos.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab20/Apoio/Espacos.cpp -------------------------------------------------------------------------------- /Labs/Lab20/Lab20.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab20/Lab20.pdf -------------------------------------------------------------------------------- /Labs/Lab20/Respostas/lab20q1.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab20/Respostas/lab20q1.cpp -------------------------------------------------------------------------------- /Labs/Lab20/Respostas/lab20q2.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() 5 | { 6 | cout << "Digite valores para a, b e c ( \"a\" maior que 1 ):\n"; 7 | int a, b, c; 8 | cin >> a >> b >> c; 9 | 10 | int soma = 0; 11 | for (int i = b; i <= c; i++) 12 | if (i % a == 0) 13 | soma += i; 14 | 15 | cout << "A soma e igual a " << soma << endl; 16 | 17 | return 0; 18 | } 19 | -------------------------------------------------------------------------------- /Labs/Lab20/Respostas/lab20q3.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | const int MaxQ = 10; 4 | 5 | int main() 6 | { 7 | double donativos[MaxQ]; 8 | 9 | cout << "Digite ate 10 valores de donativos (zero para encerrar):\n"; 10 | double num; 11 | cin >> num; 12 | 13 | int qnd = 0; 14 | double soma = 0; 15 | while (num != 0) 16 | { 17 | if (qnd < MaxQ) 18 | { 19 | donativos[qnd++] = num; 20 | soma += num; 21 | } 22 | cin >> num; 23 | } 24 | 25 | double media = soma / qnd; 26 | int cont = 0; 27 | for (int i = 0; i < qnd; i++) 28 | if (donativos[i] > media) 29 | ++cont; 30 | 31 | cout << fixed; 32 | cout.precision(2); 33 | 34 | cout << "A media dos valores doados foi de R$ " << media << ".\n"; 35 | cout << cont << " valores foram maiores que a media.\n"; 36 | 37 | return 0; 38 | } 39 | -------------------------------------------------------------------------------- /Labs/Lab20/Respostas/lab20q4.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | const int NumAulas = 66; 4 | const float MaxPercFaltas = 0.25; 5 | 6 | int main() 7 | { 8 | cout << "Digite as notas e frequencia na disciplina\n"; 9 | cout << "Nota 1: "; 10 | float n1; cin >> n1; 11 | cout << "Nota 2: "; 12 | float n2; cin >> n2; 13 | cout << "Nota 3: "; 14 | float n3; cin >> n3; 15 | cout << "Faltas: "; 16 | int faltas; 17 | cin >> faltas; 18 | 19 | float mp = (n1 + n2 + n3) / 3; 20 | 21 | if (faltas > MaxPercFaltas * NumAulas) 22 | cout << "Reprovado por falta\n"; 23 | else if (mp >= 7) 24 | cout << "Aprovado\n"; 25 | else if (mp >= 3.5 && mp < 7) 26 | { 27 | cout << "4a Prova\n"; 28 | cout << "Digite sua 4a nota: "; 29 | float n4; 30 | cin >> n4; 31 | 32 | if ((mp * 0.7 + n4 * 0.3) >= 5) 33 | cout << "Aprovado\n"; 34 | else 35 | cout << "Reprovado\n"; 36 | } 37 | else 38 | cout << "Reprovado\n"; 39 | 40 | return 0; 41 | } 42 | -------------------------------------------------------------------------------- /Labs/Lab21/Apoio/Faixa.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | const char * qualifica[4] = // vetor de ponteiros para char 5 | { "jovem.\n", "adulto.\n", "velho.\n", "bebe.\n" }; 6 | 7 | int main() 8 | { 9 | int idade, indice; 10 | cout << "Entre com sua idade em anos: "; 11 | cin >> idade; 12 | 13 | if (idade > 17 && idade < 35) 14 | indice = 0; 15 | else if (idade >= 35 && idade < 50) 16 | indice = 1; 17 | else if (idade >= 50 && idade < 65) 18 | indice = 2; 19 | else 20 | indice = 3; 21 | cout << "Voce se qualifica na categoria " << qualifica[indice]; 22 | 23 | return 0; 24 | } 25 | -------------------------------------------------------------------------------- /Labs/Lab21/Apoio/Formatando.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() 4 | { 5 | cout << "Este programa pode formatar seu disco rigido\n" 6 | "e destruir todos os seus dados.\n" 7 | "Voce deseja continuar? "; 8 | char ch; 9 | cin >> ch; 10 | 11 | if (ch == 's' || ch == 'S') 12 | cout << "Voce foi avisado!\a\a\n"; 13 | else if (ch == 'n' || ch == 'N') 14 | cout << "Uma escolha sabia... Tchau!\n"; 15 | else 16 | cout << "Voce nao respondeu corretamente, eu deveria apagar seu disco!\n"; 17 | 18 | return 0; 19 | } 20 | -------------------------------------------------------------------------------- /Labs/Lab21/Apoio/Inteiro.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab21/Apoio/Inteiro.cpp -------------------------------------------------------------------------------- /Labs/Lab21/Apoio/Vizinhos.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | const int VetTam = 6; 4 | int main() 5 | { 6 | int idades[VetTam]; 7 | cout << "Entre com a idade dos seus vizinhos.\nO programa termina quando voce tiver\n" 8 | << VetTam << " entradas ou digitar um valor negativo.\n"; 9 | 10 | int i = 0; 11 | int temp; 12 | bool tem_vaga = true; 13 | 14 | cout << "Idade: "; 15 | while (tem_vaga && cin >> temp && temp >= 0) 16 | { 17 | idades[i++] = temp; 18 | if (i < VetTam) 19 | cout << "Idade: "; 20 | else 21 | tem_vaga = false; 22 | } 23 | 24 | if (i == 0) 25 | cout << "Sem dados, tchau!\n"; 26 | else 27 | { 28 | cout << "Entre com sua idade: "; 29 | int voce; 30 | cin >> voce; 31 | 32 | int cont = 0; 33 | for (int j = 0; j < i; j++) 34 | { 35 | if (idades[j] > voce) 36 | ++cont; 37 | } 38 | 39 | cout << cont; 40 | cout << " dos seus vizinhos sao mais velhos que voce.\n"; 41 | } 42 | 43 | return 0; 44 | } 45 | -------------------------------------------------------------------------------- /Labs/Lab21/Lab21.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab21/Lab21.pdf -------------------------------------------------------------------------------- /Labs/Lab21/Respostas/lab21q1.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | struct doacao 5 | { 6 | char nome[30]; 7 | double valor; 8 | }; 9 | 10 | int main() 11 | { 12 | cout << "Digite o numero de contribuintes: "; 13 | int contrib; 14 | cin >> contrib; 15 | 16 | doacao * vet = new doacao[contrib]; 17 | 18 | for (int i=0; i < contrib; i++) 19 | { 20 | cin.get(); // descarta \n do buffer 21 | cout << "#" << i+1 << endl; 22 | cout << "Nome: "; 23 | cin.getline(vet[i].nome, 30); 24 | cout << "Valor: "; 25 | cin >> vet[i].valor; 26 | } 27 | 28 | 29 | // Grandes patronos 30 | bool listaVazia = true; 31 | cout << "\nGrandes Patronos\n"; 32 | for (int i=0; i < contrib; i++) 33 | if (vet[i].valor >= 10000) 34 | { 35 | cout << vet[i].nome << " " << vet[i].valor << endl; 36 | listaVazia = false; 37 | } 38 | if (listaVazia) 39 | cout << "Nenhum\n"; 40 | 41 | 42 | // Patronos 43 | listaVazia = true; 44 | cout << "\nPatronos\n"; 45 | for (int i=0; i < contrib; i++) 46 | if (vet[i].valor < 10000) 47 | { 48 | cout << vet[i].nome << " " << vet[i].valor << endl; 49 | listaVazia = false; 50 | } 51 | if (listaVazia) 52 | cout << "Nenhum\n"; 53 | 54 | delete [] vet; 55 | 56 | return 0; 57 | } 58 | -------------------------------------------------------------------------------- /Labs/Lab21/Respostas/lab21q2.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | const double NIV1 = 5000; 5 | const double NIV2 = 15000; 6 | const double NIV3 = 35000; 7 | 8 | const double TAXA1 = 0.10; 9 | const double TAXA2 = 0.15; 10 | const double TAXA3 = 0.20; 11 | 12 | int main( ) 13 | { 14 | double renda; 15 | double imposto; 16 | 17 | cout << "Digite a sua renda (zero para sair): "; 18 | cin >> renda; 19 | 20 | while (renda != 0) 21 | { 22 | if (renda <= NIV1) 23 | imposto = 0; 24 | else if (renda <= NIV2) 25 | imposto = (renda - NIV1) * TAXA1; 26 | else if (renda <= NIV3) 27 | imposto = (NIV2 - NIV1) * TAXA1 + (renda - NIV2) * TAXA2; 28 | else 29 | imposto = (NIV2 - NIV1) * TAXA1 + (NIV3 - NIV2) * TAXA2 + (renda - NIV3) * TAXA3; 30 | 31 | cout << "Imposto devido: " << imposto << ".\n\n"; 32 | 33 | cout << "Digite a sua renda (zero para sair): "; 34 | cin >> renda; 35 | } 36 | 37 | return 0; 38 | } -------------------------------------------------------------------------------- /Labs/Lab21/Respostas/lab21q3.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab21/Respostas/lab21q3.cpp -------------------------------------------------------------------------------- /Labs/Lab21/Respostas/lab21q4.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab21/Respostas/lab21q4.cpp -------------------------------------------------------------------------------- /Labs/Lab21/Respostas/lab21r5.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() 5 | { 6 | // De Morgan's Law 7 | // !(X && Y && Z) == !X || !Y || !Z 8 | 9 | int n = 0; 10 | while (n % 3 != 2 || n % 5 != 3 || n % 7 != 4) 11 | n++; 12 | cout << n << endl; 13 | 14 | } -------------------------------------------------------------------------------- /Labs/Lab22/Apoio/Classifica.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab22/Apoio/Classifica.cpp -------------------------------------------------------------------------------- /Labs/Lab22/Apoio/Cores.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | enum { red, orange, yellow, green }; 5 | 6 | int main() 7 | { 8 | cout << "Entre com o codigo da cor (0 a 3): "; 9 | int cor; 10 | cin >> cor; 11 | 12 | while (cor >= red && cor <= green) { 13 | switch (cor) { 14 | case red: cout << "Seus labios eram vermelhos.\n"; break; 15 | case orange: cout << "Sua roupa era laranja.\n"; break; 16 | case yellow: cout << "Seus sapatos eram amarelos.\n"; break; 17 | case green: cout << "Seus olhos eram verdes.\n"; break; 18 | } 19 | cout << "Entre com o codigo da cor (0 a 3): "; 20 | cin >> cor; 21 | } 22 | 23 | cout << "Tchau!\n"; 24 | 25 | return 0; 26 | } -------------------------------------------------------------------------------- /Labs/Lab22/Apoio/Lanche.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab22/Apoio/Lanche.cpp -------------------------------------------------------------------------------- /Labs/Lab22/Apoio/Maior.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() 5 | { 6 | cout << "Entre com dois inteiros: "; 7 | int a, b; 8 | cin >> a >> b; 9 | 10 | cout << "O maior entre " << a << " e " << b; 11 | int maior = a > b ? a : b; 12 | cout << " = " << maior << endl; 13 | 14 | return 0; 15 | } -------------------------------------------------------------------------------- /Labs/Lab22/Apoio/Menu.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | void mostramenu(); 5 | void relatorio(); 6 | void bajular(); 7 | 8 | int main() 9 | { 10 | mostramenu(); 11 | 12 | int escolha; 13 | cin >> escolha; 14 | 15 | while (escolha != 5) 16 | { 17 | switch (escolha) 18 | { 19 | case 1: cout << "\a\n\n"; 20 | break; 21 | case 2: relatorio(); 22 | break; 23 | case 3: cout << "Eu estava doente.\n\n"; 24 | break; 25 | case 4: bajular(); 26 | break; 27 | default: cout << "opcao invalida.\n\n"; 28 | } 29 | 30 | mostramenu(); 31 | cin >> escolha; 32 | } 33 | 34 | return 0; 35 | } 36 | 37 | void mostramenu() 38 | { 39 | cout << "1) Alarme 2) Relatorio\n" 40 | "3) Desculpa 4) Bajulacao\n" 41 | "5) Sair\n" 42 | "Por favor, entre com uma opcao: "; 43 | } 44 | 45 | void relatorio() 46 | { 47 | cout << "Tem sido uma excelente semana para negocios.\n" 48 | "As vendas subiram 120%. Os gastos cairam 35%.\n\n"; 49 | 50 | } 51 | void bajular() 52 | { 53 | cout << "Seus empregados acham voce o melhor chefe\n" 54 | "da industria. Os seus socios o consideram\n" 55 | "o melhor empresario do mercado.\n\n"; 56 | } 57 | -------------------------------------------------------------------------------- /Labs/Lab22/Lab22.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab22/Lab22.pdf -------------------------------------------------------------------------------- /Labs/Lab22/Respostas/lab22q1.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | 5 | int main() 6 | { 7 | int letras = 0; 8 | char ch; 9 | 10 | cin >> ch; 11 | while (ch != '!' && ch != '?') 12 | { 13 | if (isalpha(ch)) 14 | letras++; 15 | cin >> ch; 16 | } 17 | 18 | return 0; 19 | } -------------------------------------------------------------------------------- /Labs/Lab22/Respostas/lab22q2.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | 5 | int main() 6 | { 7 | cout << "Digite seu texto (@ para sair):\n"; 8 | 9 | char ch; 10 | cin.get(ch); 11 | while (ch != '@') 12 | { 13 | if (!isdigit(ch)) 14 | { 15 | if (islower(ch)) 16 | ch = toupper(ch); 17 | else 18 | ch = tolower(ch); 19 | cout << ch; 20 | } 21 | cin.get(ch); 22 | } 23 | 24 | cout << endl; 25 | 26 | return 0; 27 | } 28 | -------------------------------------------------------------------------------- /Labs/Lab22/Respostas/lab22q3.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | enum prefs {NOME, CARGO, APELIDO}; 5 | 6 | const int MAX = 4; 7 | 8 | struct bop 9 | { 10 | char nome[50]; 11 | char cargo[50]; 12 | char apelido[50]; 13 | int pref; 14 | }; 15 | 16 | int main() 17 | { 18 | bop vet[MAX] = 19 | { 20 | {"Jose", "Contador", "Paquito", APELIDO}, 21 | {"Marcos", "Porteiro", "Bibiri", CARGO}, 22 | {"Joao", "Seguranca", "Montanha", CARGO}, 23 | {"Carlos", "Motorista", "Tito", NOME} 24 | }; 25 | 26 | cout << "Listagem de Funcionarios" << endl; 27 | cout << endl; 28 | cout << "a. Mostrar por nome" << endl; 29 | cout << "b. Mostrar por cargo" << endl; 30 | cout << "c. Mostrar por apelido" << endl; 31 | cout << "d. Mostrar por preferencia" << endl; 32 | cout << "e. Sair" << endl; 33 | cout << endl; 34 | 35 | cout << "Digite sua opcao: "; 36 | char op; 37 | cin >> op; 38 | 39 | while (op != 'e') 40 | { 41 | switch (op) 42 | { 43 | case 'a': 44 | for (int i=0; i < MAX; i++) 45 | cout << vet[i].nome << endl; 46 | break; 47 | 48 | case 'b': 49 | for (int i=0; i < MAX; i++) 50 | cout << vet[i].cargo << endl; 51 | break; 52 | 53 | case 'c': 54 | for (int i=0; i < MAX; i++) 55 | cout << vet[i].apelido << endl; 56 | break; 57 | 58 | case 'd': 59 | for (int i=0; i < MAX; i++) 60 | { 61 | switch (vet[i].pref) 62 | { 63 | case NOME: cout << vet[i].nome << endl; break; 64 | case CARGO: cout << vet[i].cargo << endl; break; 65 | case APELIDO: cout << vet[i].apelido << endl; break; 66 | default : cout << "Preferencia invalida" << endl; 67 | } 68 | } 69 | break; 70 | 71 | default: 72 | cout << "Opcao invalida!" << endl; 73 | } 74 | 75 | cout << "\nDigite sua opcao: "; 76 | cin >> op; 77 | } 78 | 79 | cout << "Tchau!" << endl; 80 | 81 | return 0; 82 | } -------------------------------------------------------------------------------- /Labs/Lab22/Respostas/lab22q4.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab22/Respostas/lab22q4.cpp -------------------------------------------------------------------------------- /Labs/Lab22/Respostas/lab22q5.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() 5 | { 6 | cout << "Menu \n" 7 | "a) Inserir\n" 8 | "b) Remover\n" 9 | "c) Buscar\n" 10 | "d) Sair\n" 11 | "Escolha: "; 12 | 13 | char op; 14 | cin >> op; 15 | while (op != 'd') 16 | { 17 | switch (op) 18 | { 19 | case 'a': cout << "Inserir\n"; break; 20 | case 'b': cout << "Remover\n"; break; 21 | case 'c': cout << "Buscar\n"; break; 22 | default: cout << "Opcao Invalida\n"; break; 23 | } 24 | 25 | cout << "Escolha: "; 26 | cin >> op; 27 | } 28 | 29 | return 0; 30 | } -------------------------------------------------------------------------------- /Labs/Lab23/Apoio/Lab23r02.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab23/Apoio/Lab23r02.cpp -------------------------------------------------------------------------------- /Labs/Lab23/Apoio/MediaArq.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab23/Apoio/MediaArq.cpp -------------------------------------------------------------------------------- /Labs/Lab23/Apoio/Promocional.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab23/Apoio/Promocional.cpp -------------------------------------------------------------------------------- /Labs/Lab23/Apoio/sol.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab23/Apoio/sol.txt -------------------------------------------------------------------------------- /Labs/Lab23/Lab23.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab23/Lab23.pdf -------------------------------------------------------------------------------- /Labs/Lab23/Respostas/lab23q1.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | 5 | int main() 6 | { 7 | ifstream fin; 8 | fin.open("pescado.txt"); 9 | if (!fin.is_open()) 10 | { 11 | cout << "Erro na abertura do arquivo!\n"; 12 | system("pause"); 13 | exit(EXIT_FAILURE); 14 | } 15 | 16 | char nome[40]; 17 | int peso; 18 | int quant; 19 | int total = 0; 20 | 21 | fin >> nome; 22 | while (!fin.eof()) 23 | { 24 | fin >> peso; 25 | fin >> quant; 26 | total += peso; 27 | fin >> nome; 28 | } 29 | 30 | fin.close(); 31 | 32 | cout << "Total de quilos pescado = " << total << endl; 33 | 34 | return 0; 35 | } 36 | -------------------------------------------------------------------------------- /Labs/Lab23/Respostas/lab23q2.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | 5 | int main() 6 | { 7 | ifstream fin; 8 | fin.open("situacao.txt"); 9 | if (!fin.is_open()) 10 | { 11 | cout << "Erro na abertura do arquivo!\n"; 12 | exit(EXIT_FAILURE); 13 | } 14 | 15 | ofstream fout; 16 | fout.open("resultado.txt"); 17 | if (!fout.is_open()) 18 | { 19 | cout << "Erro na abertura do arquivo!\n"; 20 | exit(EXIT_FAILURE); 21 | } 22 | 23 | float n1, n2, n3, media; 24 | 25 | char nome[40]; 26 | fin >> nome; 27 | 28 | while (!fin.eof()) 29 | { 30 | fin >> n1; 31 | fin >> n2; 32 | fin >> n3; 33 | 34 | fout << nome << " "; 35 | 36 | media = (n1*2 + n2*3 + n3*4)/9; 37 | 38 | if (media >= 7.0) 39 | fout << "Aprovado" << endl; 40 | else 41 | if (media < 3.5) 42 | fout << "Reprovado" << endl; 43 | else 44 | fout << "4a Prova" << endl; 45 | 46 | fin >> nome; 47 | } 48 | 49 | fin.close(); 50 | fout.close(); 51 | 52 | cout << "Pronto!" << endl; 53 | return 0; 54 | } 55 | -------------------------------------------------------------------------------- /Labs/Lab23/Respostas/lab23q3.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | using namespace std; 5 | 6 | int main() 7 | { 8 | int total = 0; 9 | int vogal = 0; 10 | int conso = 0; 11 | int outro = 0; 12 | 13 | ifstream fin; 14 | fin.open("texto.txt"); 15 | if (!fin.is_open()) 16 | { 17 | cout << "Erro na abertura do arquivo!\n"; 18 | system("pause"); 19 | exit(EXIT_FAILURE); 20 | } 21 | 22 | char ch; 23 | fin.get(ch); 24 | while (!fin.eof()) 25 | { 26 | total++; 27 | if (isalpha(ch)) 28 | { 29 | switch (ch) 30 | { 31 | case 'a': 32 | case 'A': 33 | case 'e': 34 | case 'E': 35 | case 'i': 36 | case 'I': 37 | case 'o': 38 | case 'O': 39 | case 'u': 40 | case 'U': vogal++; break; 41 | default : conso++; 42 | } 43 | } 44 | else 45 | outro++; 46 | 47 | fin.get(ch); 48 | } 49 | 50 | fin.close(); 51 | 52 | cout << "Total de caracteres: " << total << endl; 53 | cout << vogal << " vogais\n"; 54 | cout << conso << " consoantes\n"; 55 | cout << outro << " outros\n"; 56 | 57 | return 0; 58 | } -------------------------------------------------------------------------------- /Labs/Lab23/Respostas/lab23q4.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | 5 | int main() 6 | { 7 | system("vol > vol.txt"); 8 | 9 | ifstream fin; 10 | fin.open("vol.txt"); 11 | if (!fin.is_open()) 12 | { 13 | cout << "Erro na abertura do arquivo!\n"; 14 | exit(EXIT_FAILURE); 15 | } 16 | 17 | char volume[50]; 18 | for (int i=0; i < 6; i++) 19 | fin >> volume; 20 | 21 | char numSerie[50]; 22 | for (int i=0; i < 5; i++) 23 | fin >> numSerie; 24 | 25 | fin.close(); 26 | 27 | cout << "Este programa funciona no Windows 7" << endl; 28 | cout << "Volume: " << volume << endl; 29 | cout << "Numero de Serie: " << numSerie << endl; 30 | 31 | return 0; 32 | } -------------------------------------------------------------------------------- /Labs/Lab23/Respostas/lab23q5.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | 5 | int main() 6 | { 7 | cout << "Nome do arquivo: "; 8 | char arquivo[50]; 9 | cin >> arquivo; 10 | 11 | cout << "Palavra: "; 12 | char palavra[50]; 13 | cin >> palavra; 14 | 15 | ifstream fin; 16 | fin.open(arquivo); 17 | if (!fin.is_open()) 18 | { 19 | cout << "Erro na abertura do arquivo!\n"; 20 | exit(EXIT_FAILURE); 21 | } 22 | 23 | bool encontrada = false; 24 | char token[50]; 25 | 26 | while (fin >> token && !encontrada) 27 | { 28 | if (!strcmp(token, palavra)) 29 | encontrada = true; 30 | } 31 | fin.close(); 32 | 33 | if (encontrada) 34 | cout << "A palavra \"" << palavra << "\" esta presente no texto." << endl; 35 | else 36 | cout << "A palavra \"" << palavra << "\" nao esta no texto." << endl; 37 | 38 | return 0; 39 | } 40 | -------------------------------------------------------------------------------- /Labs/Lab23/Respostas/pescado.txt: -------------------------------------------------------------------------------- 1 | Doudorado 250 20 2 | Tilapia 300 25 3 | Carpa 400 40 4 | Sardinha 50 10 5 | Atum 150 15 -------------------------------------------------------------------------------- /Labs/Lab23/Respostas/resultado.txt: -------------------------------------------------------------------------------- 1 | Wilson 4a Prova 2 | Silvio 4a Prova 3 | Luis Aprovado 4 | Pedro Reprovado 5 | -------------------------------------------------------------------------------- /Labs/Lab23/Respostas/situacao.txt: -------------------------------------------------------------------------------- 1 | Wilson 8.2 7.5 5.0 2 | Silvio 3.2 7.5 7.2 3 | Luis 6.0 7.0 9.0 4 | Pedro 3.0 3.0 1.0 -------------------------------------------------------------------------------- /Labs/Lab23/Respostas/texto.txt: -------------------------------------------------------------------------------- 1 | Os 12 bravos homens lutaram 2 | ate a morte naqueles 15 minutos de batalha. -------------------------------------------------------------------------------- /Labs/Lab23/Respostas/vol.txt: -------------------------------------------------------------------------------- 1 | Volume in drive C is Windows 2 | Volume Serial Number is A860-8760 3 | -------------------------------------------------------------------------------- /Labs/Lab24/Apoio/Escrita.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() 5 | { 6 | ofstream fout; 7 | fout.open("valores.dat", ios_base::out | ios_base::binary); 8 | 9 | const unsigned short TamVet = 3; 10 | long vet[TamVet] = { 38, 42, -51 }; 11 | 12 | // escreve quantidade de elementos 13 | fout.write((char *)&TamVet, sizeof(unsigned short)); 14 | 15 | // escreve elementos do vetor 16 | for (unsigned short i = 0; i < TamVet; ++i) 17 | fout.write((char *)&vet[i], sizeof(long)); 18 | 19 | fout.close(); 20 | 21 | return 0; 22 | } 23 | 24 | -------------------------------------------------------------------------------- /Labs/Lab24/Apoio/Leitura.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab24/Apoio/Leitura.cpp -------------------------------------------------------------------------------- /Labs/Lab24/Apoio/Planetas.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab24/Apoio/Planetas.cpp -------------------------------------------------------------------------------- /Labs/Lab24/Lab24.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab24/Lab24.pdf -------------------------------------------------------------------------------- /Labs/Lab24/Respostas/imagem.cor: -------------------------------------------------------------------------------- 1 | 220220220220220220000220000220220220220220220220000000000220220220220220220 -------------------------------------------------------------------------------- /Labs/Lab24/Respostas/lab24q1.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab24/Respostas/lab24q1.cpp -------------------------------------------------------------------------------- /Labs/Lab24/Respostas/lab24q2.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab24/Respostas/lab24q2.cpp -------------------------------------------------------------------------------- /Labs/Lab24/Respostas/lab24q3.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab24/Respostas/lab24q3.cpp -------------------------------------------------------------------------------- /Labs/Lab24/Respostas/lab24q4.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab24/Respostas/lab24q4.cpp -------------------------------------------------------------------------------- /Labs/Lab24/Respostas/lab24r1.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | 5 | int main() 6 | { 7 | ifstream fin; 8 | fin.open("pescado.txt"); 9 | if (!fin.is_open()) 10 | { 11 | cout << "Erro na abertura do arquivo!\n"; 12 | system("pause"); 13 | exit(EXIT_FAILURE); 14 | } 15 | 16 | char nome[40]; 17 | int peso; 18 | int quant; 19 | int total = 0; 20 | 21 | fin >> nome; 22 | while (!fin.eof()) 23 | { 24 | fin >> peso; 25 | fin >> quant; 26 | total += peso; 27 | fin >> nome; 28 | } 29 | 30 | fin.close(); 31 | 32 | cout << "Total de quilos pescado = " << total << endl; 33 | 34 | return 0; 35 | } 36 | -------------------------------------------------------------------------------- /Labs/Lab24/Respostas/lab24r2.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | 5 | struct peixe 6 | { 7 | char nome[20]; 8 | unsigned peso; 9 | float comp; 10 | }; 11 | 12 | int main() 13 | { 14 | peixe p; 15 | 16 | ifstream fin; 17 | fin.open("peixes.dat", ios_base::in | ios_base::binary); 18 | if (!fin.is_open()) 19 | { 20 | cout << "Erro na abertura do arquivo!\n"; 21 | system("pause"); 22 | exit(EXIT_FAILURE); 23 | } 24 | 25 | cout << "Peixes Cadastrados" << endl; 26 | while (fin.read((char*) &p, sizeof p)) 27 | { 28 | cout << p.nome << " " 29 | << p.peso << " " 30 | << p.comp << endl; 31 | } 32 | cout << endl; 33 | fin.close(); 34 | 35 | ofstream fout; 36 | fout.open("peixes.dat", ios_base::out | ios_base::app | ios_base::binary); 37 | if (!fout.is_open()) 38 | { 39 | cout << "Erro na abertura do arquivo!\n"; 40 | system("pause"); 41 | exit(EXIT_FAILURE); 42 | } 43 | 44 | cout << "Cadastro de Novo Peixe" << endl; 45 | cout << "Nome do Peixe: "; 46 | cin >> p.nome; 47 | cout << "Peso (gramas): "; 48 | cin >> p.peso; 49 | cout << "Comprimento (cm): "; 50 | cin >> p.comp; 51 | 52 | fout.write((char*) &p, sizeof p); 53 | fout.close(); 54 | 55 | return 0; 56 | } 57 | -------------------------------------------------------------------------------- /Labs/Lab24/Respostas/lab24r3.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | 5 | struct peixe 6 | { 7 | char nome[20]; 8 | unsigned peso; 9 | float comp; 10 | }; 11 | 12 | int main() 13 | { 14 | peixe p; 15 | 16 | ifstream fin; 17 | fin.open("pescado.txt"); 18 | if (!fin.is_open()) 19 | { 20 | cout << "Erro na abertura do arquivo texto!\n"; 21 | system("pause"); 22 | exit(EXIT_FAILURE); 23 | } 24 | 25 | ofstream fout; 26 | fout.open("pescado.dat", ios_base::out | ios_base::binary); 27 | if (!fout.is_open()) 28 | { 29 | cout << "Erro na abertura do arquivo binario!\n"; 30 | system("pause"); 31 | exit(EXIT_FAILURE); 32 | } 33 | 34 | fin >> p.nome; 35 | while (!fin.eof()) 36 | { 37 | fin >> p.peso; 38 | fin >> p.comp; 39 | 40 | fout.write((char*) &p, sizeof p); 41 | 42 | fin >> p.nome; 43 | } 44 | 45 | fin.close(); 46 | fout.close(); 47 | 48 | cout << "Pronto" << endl; 49 | 50 | return 0; 51 | } 52 | -------------------------------------------------------------------------------- /Labs/Lab24/Respostas/mensagem.cor: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab24/Respostas/mensagem.cor -------------------------------------------------------------------------------- /Labs/Lab24/Respostas/peixes.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab24/Respostas/peixes.dat -------------------------------------------------------------------------------- /Labs/Lab24/Respostas/pescado.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab24/Respostas/pescado.dat -------------------------------------------------------------------------------- /Labs/Lab24/Respostas/pescado.txt: -------------------------------------------------------------------------------- 1 | Doudorado 250 20 2 | Tilapia 300 25 3 | Carpa 400 40 4 | Sardinha 50 10 5 | Atum 150 15 -------------------------------------------------------------------------------- /Labs/Lab25/Apoio/FaixaVetor.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab25/Apoio/FaixaVetor.cpp -------------------------------------------------------------------------------- /Labs/Lab25/Apoio/Imoveis.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab25/Apoio/Imoveis.cpp -------------------------------------------------------------------------------- /Labs/Lab25/Apoio/SomaVetor.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab25/Apoio/SomaVetor.cpp -------------------------------------------------------------------------------- /Labs/Lab25/Apoio/TamVet.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab25/Apoio/TamVet.cpp -------------------------------------------------------------------------------- /Labs/Lab25/Apoio/Vetores.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab25/Apoio/Vetores.cpp -------------------------------------------------------------------------------- /Labs/Lab25/Lab25.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab25/Lab25.pdf -------------------------------------------------------------------------------- /Labs/Lab25/Respostas/lab25q1.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | struct Par 5 | { 6 | int x; 7 | int y; 8 | }; 9 | 10 | void organiza(Par v[], int tam); 11 | 12 | int main() 13 | { 14 | Par vet[10]; 15 | Par p; 16 | 17 | cout << "Digite pares de valores (0 para encerrar):\n"; 18 | int i = 0; 19 | while((cin >> p.x) && (p.x != 0) && (cin >> p.y) && (p.y != 0) && (i < 10)) 20 | vet[i++] = p; 21 | 22 | cout << "Pares organizados:\n"; 23 | organiza(vet, i); 24 | 25 | return 0; 26 | } 27 | 28 | void organiza(Par v[], int tam) 29 | { 30 | int menor, maior; 31 | for (int i = 0; i < tam; ++i) 32 | { 33 | if (v[i].x < v[i].y) 34 | { 35 | menor = v[i].x; 36 | maior = v[i].y; 37 | } 38 | else 39 | { 40 | menor = v[i].y; 41 | maior = v[i].x; 42 | } 43 | 44 | cout << "(" << menor << "," << maior << ")" << endl; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /Labs/Lab25/Respostas/lab25q2.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab25/Respostas/lab25q2.cpp -------------------------------------------------------------------------------- /Labs/Lab25/Respostas/lab25q3.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab25/Respostas/lab25q3.cpp -------------------------------------------------------------------------------- /Labs/Lab26/Apoio/CharEmString.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab26/Apoio/CharEmString.cpp -------------------------------------------------------------------------------- /Labs/Lab26/Apoio/InverteStr.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab26/Apoio/InverteStr.cpp -------------------------------------------------------------------------------- /Labs/Lab26/Apoio/InverteStr2.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab26/Apoio/InverteStr2.cpp -------------------------------------------------------------------------------- /Labs/Lab26/Apoio/InverteStr3.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab26/Apoio/InverteStr3.cpp -------------------------------------------------------------------------------- /Labs/Lab26/Apoio/Planetas.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | 5 | void mostrar(const string * strvet, int n); 6 | 7 | int main() 8 | { 9 | string lista[5]; 10 | cout << "Digite seus 5 planetas favoritos:\n"; 11 | for (int i = 0; i < 5; i++) 12 | { 13 | cout << i + 1 << ": "; 14 | getline(cin, lista[i]); 15 | } 16 | cout << "\nSua lista:\n"; 17 | mostrar(lista, 5); 18 | 19 | return 0; 20 | } 21 | 22 | void mostrar(const string * strvet, int n) 23 | { 24 | for (int i = 0; i < n; i++) 25 | cout << strvet[i] << " "; 26 | cout << endl; 27 | } 28 | -------------------------------------------------------------------------------- /Labs/Lab26/Apoio/TempoPtr.cpp: -------------------------------------------------------------------------------- 1 | // passando registros com ponteiros 2 | #include 3 | using namespace std; 4 | 5 | struct tempo 6 | { 7 | int horas; 8 | int mins; 9 | }; 10 | 11 | const int MinsPorHora = 60; 12 | 13 | void SomaTempo(const tempo * t1, const tempo * t2, tempo * t3); 14 | void MostraTempo(const tempo * t); 15 | 16 | int main() 17 | { 18 | tempo dia1 = { 5, 45 }; 19 | tempo dia2 = { 4, 55 }; 20 | tempo dois; 21 | 22 | SomaTempo(&dia1, &dia2, &dois); 23 | cout << "Total de dois dias: "; 24 | MostraTempo(&dois); 25 | 26 | tempo dia3 = { 4, 32 }; 27 | tempo tres; 28 | SomaTempo(&dois, &dia3, &tres); 29 | 30 | cout << "Total de tres dias: "; 31 | MostraTempo(&tres); 32 | 33 | return 0; 34 | } 35 | 36 | void SomaTempo(const tempo * t1, const tempo * t2, tempo * ret) 37 | { 38 | ret->mins = (t1->mins + t2->mins) % MinsPorHora; 39 | ret->horas = t1->horas + t2->horas + (t1->mins + t2->mins) / MinsPorHora; 40 | } 41 | 42 | void MostraTempo(const tempo * t) 43 | { 44 | cout << t->horas << " horas, " << t->mins << " minutos\n"; 45 | } 46 | 47 | 48 | -------------------------------------------------------------------------------- /Labs/Lab26/Apoio/TempoValor.cpp: -------------------------------------------------------------------------------- 1 | // passando registros por valor 2 | #include 3 | using namespace std; 4 | 5 | struct tempo 6 | { 7 | int horas; 8 | int mins; 9 | }; 10 | 11 | const int MinsPorHora = 60; 12 | 13 | tempo SomaTempo(tempo t1, tempo t2); 14 | void MostraTempo(tempo t); 15 | 16 | int main() 17 | { 18 | tempo dia1 = { 5, 45 }; 19 | tempo dia2 = { 4, 55 }; 20 | 21 | tempo viagem = SomaTempo(dia1, dia2); 22 | cout << "Total de dois dias: "; 23 | MostraTempo(viagem); 24 | 25 | tempo dia3 = { 4, 32 }; 26 | 27 | cout << "Total de tres dias: "; 28 | MostraTempo(SomaTempo(viagem, dia3)); 29 | 30 | return 0; 31 | } 32 | 33 | tempo SomaTempo(tempo t1, tempo t2) 34 | { 35 | tempo total; 36 | total.mins = (t1.mins + t2.mins) % MinsPorHora; 37 | total.horas = t1.horas + t2.horas + (t1.mins + t2.mins) / MinsPorHora; 38 | return total; 39 | } 40 | 41 | void MostraTempo(tempo t) 42 | { 43 | cout << t.horas << " horas, " << t.mins << " minutos\n"; 44 | } 45 | -------------------------------------------------------------------------------- /Labs/Lab26/Lab26.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab26/Lab26.pdf -------------------------------------------------------------------------------- /Labs/Lab26/Respostas/lab26q1.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | const char * Mes[4] = { "Marco", "Abril", "Junho", "Julho" }; 5 | 6 | void preencher(double vet[], int tam); 7 | void mostrar(const double vet[], int tam); 8 | 9 | int main() 10 | { 11 | const int VetTam = 4; 12 | double gastos[VetTam]; 13 | preencher(gastos, VetTam); 14 | mostrar(gastos, VetTam); 15 | 16 | return 0; 17 | } 18 | 19 | void preencher(double vet[], int tam) 20 | { 21 | for (int i = 0; i < tam; i++) 22 | { 23 | cout << "Entre com o gasto de " << Mes[i] << ": "; 24 | cin >> vet[i]; 25 | } 26 | } 27 | 28 | void mostrar(const double vet[], int tam) 29 | { 30 | double total = 0.0; 31 | cout << "\nGastos\n"; 32 | for (int i = 0; i < tam; i++) 33 | { 34 | cout << Mes[i] << ": R$" << vet[i] << endl; 35 | total += vet[i]; 36 | } 37 | cout << "Total de gastos: R$" << total << endl; 38 | } 39 | 40 | -------------------------------------------------------------------------------- /Labs/Lab26/Respostas/lab26q2.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab26/Respostas/lab26q2.cpp -------------------------------------------------------------------------------- /Labs/Lab26/Respostas/lab26q3.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | const int TAM_NOME = 30; 5 | 6 | struct aluno 7 | { 8 | char nome[TAM_NOME]; 9 | int nivel; 10 | }; 11 | 12 | int PegarInfo(aluno va[], int n); 13 | void Mostrar1(aluno a); 14 | void Mostrar2(const aluno * pa); 15 | void Mostrar3(const aluno va[], int n); 16 | 17 | int main() 18 | { 19 | cout << "Tamanho da classe: "; 20 | int tam; 21 | cin >> tam; 22 | 23 | // remove \n para uso do cin.getline 24 | while (cin.get() != '\n') 25 | continue; 26 | 27 | aluno * ptr = new aluno[tam]; 28 | int inscritos = PegarInfo(ptr, tam); 29 | for (int i = 0; i < inscritos; ++i) 30 | { 31 | Mostrar1(ptr[i]); 32 | Mostrar2(&ptr[i]); 33 | } 34 | Mostrar3(ptr, inscritos); 35 | delete[] ptr; 36 | cout << "Feito!\n"; 37 | 38 | return 0; 39 | } 40 | 41 | int PegarInfo(aluno va[], int n) 42 | { 43 | int i; 44 | for (i = 0; 45 | i < n && (cout << "Nome: ", cin.getline(va[i].nome, TAM_NOME), strcmp(va[i].nome, "")); 46 | ++i) 47 | { 48 | cout << "Nivel: "; 49 | cin >> va[i].nivel; 50 | 51 | // remove \n para uso do cin.getline 52 | while (cin.get() != '\n') 53 | continue; 54 | } 55 | return i; 56 | } 57 | 58 | void Mostrar1(aluno a) 59 | { 60 | cout << a.nome << " " << a.nivel << endl; 61 | } 62 | 63 | void Mostrar2(const aluno * pa) 64 | { 65 | cout << pa->nome << " " << pa->nivel << endl; 66 | } 67 | 68 | void Mostrar3(const aluno va[], int n) 69 | { 70 | for (int i = 0; i < n; ++i) 71 | { 72 | cout << va[i].nome << " " << va[i].nivel << endl; 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /Labs/Lab27/Apoio/Estimar.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | double tom(int); 5 | double pam(int); 6 | 7 | void estimar(int linhas, double(*pf)(int)); 8 | 9 | int main() 10 | { 11 | int code; 12 | cout << "Quantas linhas de codigo voce precisa? "; 13 | cin >> code; 14 | cout << "Estimativa de Tom:\n"; 15 | estimar(code, tom); 16 | cout << "Estimativa de Pam:\n"; 17 | estimar(code, pam); 18 | 19 | return 0; 20 | } 21 | 22 | double tom(int lns) 23 | { 24 | return 0.05 * lns; 25 | } 26 | 27 | double pam(int lns) 28 | { 29 | return 0.03 * lns + 0.0004 * lns * lns; 30 | } 31 | 32 | void estimar(int linhas, double(*pf)(int)) 33 | { 34 | cout << linhas << " linhas levam "; 35 | cout << pf(linhas) << " hora(s)\n"; 36 | } 37 | -------------------------------------------------------------------------------- /Labs/Lab27/Apoio/Inline.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | inline double square(double x) 5 | { return x * x; } 6 | 7 | int main() 8 | { 9 | double a, b; 10 | double c = 13.0; 11 | 12 | a = square(5.0); 13 | b = square(4.5 + 7.5); 14 | cout << "a = " << a << ", b = " << b << endl; 15 | cout << "c = " << c; 16 | cout << ", c quadrado = " << square(c++) << endl; 17 | cout << "Agora c = " << c << endl; 18 | 19 | return 0; 20 | } 21 | -------------------------------------------------------------------------------- /Labs/Lab27/Lab27.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab27/Lab27.pdf -------------------------------------------------------------------------------- /Labs/Lab27/Respostas/lab27q1.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | 5 | inline int maximo(int a, int b); 6 | inline int minimo(int a, int b); 7 | inline int absoluto(int x); 8 | inline char maiusculo(char ch); 9 | 10 | int main() 11 | { 12 | int y = -2; 13 | int z = 5; 14 | int w = 1; 15 | int min = minimo(absoluto(y), z); 16 | int max = maximo(min, w); 17 | cout << "Num: " << max << endl; 18 | cout << "Letra: " << maiusculo('a') << endl; 19 | 20 | return 0; 21 | } 22 | 23 | inline int maximo(int a, int b) 24 | { 25 | return (a > b ? a : b); 26 | } 27 | 28 | inline int minimo(int a, int b) 29 | { 30 | return (a < b ? a : b); 31 | } 32 | 33 | inline int absoluto(int x) 34 | { 35 | return (x >= 0 ? x : -x); 36 | } 37 | 38 | inline char maiusculo(char ch) 39 | { 40 | return (isupper(ch) ? ch : toupper(ch)); 41 | } 42 | -------------------------------------------------------------------------------- /Labs/Lab27/Respostas/lab27q2.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | double calcular(double a, double b, double(*f) (double, double)); 5 | double soma(double x, double y); 6 | double mult(double x, double y); 7 | 8 | int main() 9 | { 10 | cout << "Digite pares de valores:\n"; 11 | double val1, val2; 12 | 13 | while (cin >> val1 >> val2) 14 | { 15 | cout << "Soma: " << calcular(val1, val2, soma) << endl; 16 | cout << "Mult: " << calcular(val1, val2, mult) << endl; 17 | } 18 | 19 | return 0; 20 | } 21 | 22 | double calcular(double a, double b, double(*f)(double, double)) 23 | { 24 | return f(a, b); 25 | } 26 | 27 | double soma(double x, double y) 28 | { 29 | return x + y; 30 | } 31 | 32 | double mult(double x, double y) 33 | { 34 | return x * y; 35 | } 36 | -------------------------------------------------------------------------------- /Labs/Lab27/Respostas/lab27q3.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | double calcular(double a, double b, double(*f) (double, double)); 5 | double soma(double x, double y); 6 | double subt(double x, double y); 7 | double mult(double x, double y); 8 | 9 | int main() 10 | { 11 | const int VetTam = 3; 12 | const char * func[VetTam] = { "Soma", "Subt", "Mult" }; 13 | double(*vet[VetTam]) (double, double) = { soma, subt, mult }; 14 | 15 | cout << "Digite pares de valores:\n"; 16 | double val1, val2; 17 | 18 | while (cin >> val1 >> val2) 19 | { 20 | for (int i = 0; i < VetTam; ++i) 21 | cout << func[i] << ": " << calcular(val1, val2, vet[i]) << endl; 22 | } 23 | 24 | return 0; 25 | } 26 | 27 | double calcular(double a, double b, double(*f)(double, double)) 28 | { 29 | return f(a, b); 30 | } 31 | 32 | double soma(double x, double y) 33 | { 34 | return x + y; 35 | } 36 | 37 | double subt(double x, double y) 38 | { 39 | return x - y; 40 | } 41 | 42 | double mult(double x, double y) 43 | { 44 | return x * y; 45 | } 46 | 47 | -------------------------------------------------------------------------------- /Labs/Lab28/Apoio/Atleta.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab28/Apoio/Atleta.cpp -------------------------------------------------------------------------------- /Labs/Lab28/Apoio/Coelhos.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab28/Apoio/Coelhos.cpp -------------------------------------------------------------------------------- /Labs/Lab28/Apoio/Roedores.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab28/Apoio/Roedores.cpp -------------------------------------------------------------------------------- /Labs/Lab28/Apoio/auxiliar.cpp: -------------------------------------------------------------------------------- 1 | 2 | extern int tamanho; 3 | 4 | int calc(int n) 5 | { 6 | return tamanho * n; 7 | } -------------------------------------------------------------------------------- /Labs/Lab28/Apoio/estatico.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab28/Apoio/estatico.cpp -------------------------------------------------------------------------------- /Labs/Lab28/Apoio/principal.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int tamanho = 1000; 5 | 6 | int calc(int); 7 | 8 | int main() 9 | { 10 | cout << tamanho << endl; 11 | cout << calc(5); 12 | cout << endl; 13 | 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /Labs/Lab28/Lab28.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab28/Lab28.pdf -------------------------------------------------------------------------------- /Labs/Lab28/Respostas/lab28q1.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | void contagem() 5 | { 6 | static int cont = 0; 7 | cout << ++cont << "a chamada da funcao.\n"; 8 | } 9 | 10 | int main() 11 | { 12 | for (int i = 0; i < 5; ++i) 13 | contagem(); 14 | 15 | return 0; 16 | } -------------------------------------------------------------------------------- /Labs/Lab28/Respostas/lab28q2.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | struct caixa 5 | { 6 | char marca[40]; 7 | float altura; 8 | float largura; 9 | float comprimento; 10 | float volume; 11 | }; 12 | 13 | void exibir(const caixa & cx); 14 | void volume(caixa & cx); 15 | 16 | int main() 17 | { 18 | caixa leite = { "Prepak", 0.25f, 0.15f, 0.1f }; 19 | exibir(leite); 20 | volume(leite); 21 | exibir(leite); 22 | 23 | return 0; 24 | } 25 | 26 | void exibir(const caixa & cx) 27 | { 28 | cout << cx.marca << ": " 29 | << cx.altura << " x " 30 | << cx.largura << " x " 31 | << cx.comprimento << ", volume = " 32 | << cx.volume << "\n"; 33 | } 34 | 35 | void volume(caixa & cx) 36 | { 37 | cx.volume = cx.altura * cx.largura * cx.comprimento; 38 | } -------------------------------------------------------------------------------- /Labs/Lab28/Respostas/lab28q3.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | struct caixa 5 | { 6 | char marca[40]; 7 | float altura; 8 | float largura; 9 | float comprimento; 10 | float volume; 11 | }; 12 | 13 | void imprimir(const caixa * pcx); 14 | void volume(caixa * pcx); 15 | 16 | int main() 17 | { 18 | caixa leite = { "Prepak", 0.25f, 0.15f, 0.1f }; 19 | imprimir(&leite); 20 | volume(&leite); 21 | imprimir(&leite); 22 | 23 | return 0; 24 | } 25 | 26 | void imprimir(const caixa * pcx) 27 | { 28 | cout << pcx->marca << ": " 29 | << pcx->altura << " x " 30 | << pcx->largura << " x " 31 | << pcx->comprimento << ", volume = " 32 | << pcx->volume << "\n"; 33 | } 34 | 35 | void volume(caixa * pcx) 36 | { 37 | pcx->volume = pcx->altura * pcx->largura * pcx->comprimento; 38 | } -------------------------------------------------------------------------------- /Labs/Lab28/Respostas/lab28q4.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | struct Par 5 | { 6 | int x; 7 | int y; 8 | }; 9 | 10 | void calcular(const Par & p, int & s, int & m); 11 | 12 | int main() 13 | { 14 | cout << "Digite dois valores:\n"; 15 | Par valor; 16 | cin >> valor.x >> valor.y; 17 | 18 | int soma; 19 | int mult; 20 | calcular(valor, soma, mult); 21 | cout << "Soma: " << soma << endl; 22 | cout << "Mult: " << mult << endl; 23 | 24 | return 0; 25 | } 26 | 27 | void calcular(const Par & p, int & s, int & m) 28 | { 29 | s = p.x + p.y; 30 | m = p.x * p.y; 31 | } -------------------------------------------------------------------------------- /Labs/Lab29/Apoio/Linha.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab29/Apoio/Linha.cpp -------------------------------------------------------------------------------- /Labs/Lab29/Apoio/Tamanho.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | 5 | unsigned tamanho(const char * str); 6 | unsigned tamanho(unsigned num); 7 | 8 | int main() 9 | { 10 | const char * viagem = "Hawaii"; // string de teste 11 | unsigned n = 12345678; // valor de teste 12 | 13 | cout << "Tamanho da string: "; 14 | cout << tamanho(viagem); 15 | cout << endl; 16 | 17 | cout << "Tamanho do numero: "; 18 | cout << tamanho(n); 19 | cout << endl; 20 | 21 | return 0; 22 | } 23 | 24 | unsigned tamanho(const char * str) 25 | { 26 | unsigned i = 0; 27 | 28 | while (str[i]) 29 | i++; 30 | return i; 31 | } 32 | 33 | unsigned tamanho(unsigned num) 34 | { 35 | unsigned digitos = 1; 36 | 37 | while (num /= 10) 38 | digitos++; 39 | return digitos; 40 | } 41 | -------------------------------------------------------------------------------- /Labs/Lab29/Apoio/Trocar.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using std::cout; 3 | using std::endl; 4 | 5 | template 6 | void trocar(T & a, T & b); 7 | 8 | int main() 9 | { 10 | int i = 10; 11 | int j = 20; 12 | double x = 24.5; 13 | double y = 81.7; 14 | 15 | cout << "valores originais:" << endl; 16 | cout << "i, j = " << i << ", " << j << endl; 17 | cout << "x, y = " << x << ", " << y << endl << endl; 18 | 19 | trocar(i, j); 20 | trocar(x, y); 21 | 22 | cout << "valores trocados:" << endl; 23 | cout << "i, j = " << i << ", " << j << endl; 24 | cout << "x, y = " << x << ", " << y << endl; 25 | cout << endl; 26 | 27 | return 0; 28 | } 29 | 30 | template 31 | void trocar(T & a, T & b) 32 | { 33 | T temp; 34 | temp = a; 35 | a = b; 36 | b = temp; 37 | } -------------------------------------------------------------------------------- /Labs/Lab29/Lab29.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab29/Lab29.pdf -------------------------------------------------------------------------------- /Labs/Lab29/Respostas/lab29q1.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | void imprimir(const char * str, bool chamadas = false); 5 | 6 | int main() 7 | { 8 | imprimir("Vamos "); 9 | imprimir("aprender "); 10 | imprimir("C++ ", true); 11 | imprimir("\n"); 12 | 13 | return 0; 14 | } 15 | 16 | void imprimir(const char * str, bool chamadas) 17 | { 18 | static int cont = 0; 19 | cout << str; 20 | ++cont; 21 | 22 | if (chamadas) 23 | { 24 | for (int i = 1; i < cont; ++i) 25 | cout << str; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Labs/Lab29/Respostas/lab29q2.cpp: -------------------------------------------------------------------------------- 1 | #define _CRT_SECURE_NO_WARNINGS 2 | #include 3 | using namespace std; 4 | 5 | 6 | struct Guloseima 7 | { 8 | char marca[24]; 9 | double peso; 10 | int calorias; 11 | }; 12 | 13 | void ajustar(Guloseima & gulo, const char * marca = "Charge", double peso = 40.0, int cals = 187); 14 | void exibir(const Guloseima & gulo); 15 | 16 | int main() 17 | { 18 | Guloseima boa, gostosa, super; 19 | 20 | ajustar(boa); 21 | exibir(boa); 22 | 23 | ajustar(gostosa, "Crunch", 25.0); 24 | exibir(gostosa); 25 | 26 | ajustar(super, "KitKat", 45.0, 241); 27 | exibir(super); 28 | 29 | return 0; 30 | } 31 | 32 | void ajustar(Guloseima & gulo, const char * marca, double peso, int cals) 33 | { 34 | strcpy(gulo.marca, marca); 35 | gulo.peso = peso; 36 | gulo.calorias = cals; 37 | } 38 | 39 | void exibir(const Guloseima & gulo) 40 | { 41 | cout << gulo.marca << " " << gulo.peso << "g " << gulo.calorias << "kcals" << endl; 42 | } 43 | -------------------------------------------------------------------------------- /Labs/Lab29/Respostas/lab29q3.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Labs/Lab29/Respostas/lab29q3.cpp -------------------------------------------------------------------------------- /Labs/Lab29/Respostas/lab29q4.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | template 5 | T max5(T vet[]) 6 | { 7 | T max = vet[0]; 8 | for (int i = 1; i < 5; ++i) 9 | { 10 | if (vet[i] > max) 11 | max = vet[i]; 12 | } 13 | return max; 14 | } 15 | 16 | int main() 17 | { 18 | int vetI[5] = { 2, 4, 3, 9, 6 }; 19 | double vetD[5] = { 1.7, 4.9, 8.5, 2.4, 3.6 }; 20 | 21 | cout << "Max Int: " << max5(vetI) << endl; 22 | cout << "Max Double: " << max5(vetD) << endl; 23 | 24 | return 0; 25 | } 26 | 27 | -------------------------------------------------------------------------------- /Labs/Lab29/Respostas/lab29q5.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | template 5 | T max5(T vet[], int n) 6 | { 7 | T max = vet[0]; 8 | for (int i = 1; i < n; ++i) 9 | { 10 | if (vet[i] > max) 11 | max = vet[i]; 12 | } 13 | return max; 14 | } 15 | 16 | int main() 17 | { 18 | int vetI[6] = { 2, 4, 3, 7, 6 , 1 }; 19 | double vetD[4] = { 1.7, 4.9, 2.4, 3.6 }; 20 | 21 | cout << "Max Int: " << max5(vetI, 6) << endl; 22 | cout << "Max Double: " << max5(vetD, 4) << endl; 23 | 24 | return 0; 25 | } 26 | 27 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Programação de Computadores 2 | 3 | Este repositório contém o material utilizado no curso de Programação de Computadores ministrado para os alunos do curso de Ciência da Computação na Universidade Federal Rural do Semi-Árido (UFERSA). O curso é desenvolvido com a linguagem C++ usando o Visual Studio 2019. 4 | 5 | O material é composto por Slides em formato PowerPoint e Laboratórios em formato PDF. Cada laboratório é acompanhado do material de apoio utilizado durante a aula teórica, e das respostas aos exercícios de fixação. Os exercícios de revisão são feitos durante a aula. Os exercícios de aprendizagem não possuem respostas e seu objetivo é servir como treinamento. 6 | 7 | A numeração dos laboratórios (Labs) coincidem com a sequência das aulas (Slides): 8 | 9 | 00. Introdução 10 | 01. Ambiente de Trabalho 11 | 02. Introdução ao C++ 12 | 03. Variáveis, Constantes e Atribuição 13 | 04. Modularidade e Funções 14 | 05. Criação de Funções 15 | 06. Tipos Inteiros 16 | 07. Tipos Caractere e Booleano 17 | 08. Tipos Ponto-Flutuante 18 | 09. Operadores Aritméticos 19 | 10. Vetores 20 | 11. Strings 21 | 12. Registros 22 | 13. Uniões e Enumerações 23 | 14. Ponteiros 24 | 15. Alocação Dinâmica de Memória 25 | 16. Laço de Repetição for 26 | 17. Aplicações do Laço for 27 | 18. Laços de Repetição while e do-while 28 | 19. Aplicações dos Laços de Repetição 29 | 20. Instrução de Desvio if 30 | 21. Operadores Lógicos 31 | 22. Instrução de Desvio switch 32 | 23. Arquivos Texto 33 | 24. Arquivos Binário 34 | 25. Funções com Vetores 35 | 26. Funções com Strings e Registros 36 | 27. Funções Inline e Ponteiros para Funções 37 | 28. Armazenamento e Referências 38 | 29. Templates e Sobrecarga de Funções 39 | 40 | O material da disciplina está em constante evolução. Se tiverem sugestões de melhoria fiquem a vontade para contribuir com o projeto. 41 | -------------------------------------------------------------------------------- /Slides/00. Introdução.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Slides/00. Introdução.pptx -------------------------------------------------------------------------------- /Slides/01. Ambiente de Trabalho.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Slides/01. Ambiente de Trabalho.pptx -------------------------------------------------------------------------------- /Slides/02. Introdução ao Cpp.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Slides/02. Introdução ao Cpp.pptx -------------------------------------------------------------------------------- /Slides/03. Variáveis Constantes e Atribuição.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Slides/03. Variáveis Constantes e Atribuição.pptx -------------------------------------------------------------------------------- /Slides/04. Modularidade e Funções.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Slides/04. Modularidade e Funções.pptx -------------------------------------------------------------------------------- /Slides/05. Criação de Funções.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Slides/05. Criação de Funções.pptx -------------------------------------------------------------------------------- /Slides/06. Tipos Inteiros.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Slides/06. Tipos Inteiros.pptx -------------------------------------------------------------------------------- /Slides/07. Tipos Caractere e Booleano.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Slides/07. Tipos Caractere e Booleano.pptx -------------------------------------------------------------------------------- /Slides/08. Tipos Ponto Flutuante.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Slides/08. Tipos Ponto Flutuante.pptx -------------------------------------------------------------------------------- /Slides/09. Operadores Aritméticos.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Slides/09. Operadores Aritméticos.pptx -------------------------------------------------------------------------------- /Slides/10. Vetores.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Slides/10. Vetores.pptx -------------------------------------------------------------------------------- /Slides/11. Strings.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Slides/11. Strings.pptx -------------------------------------------------------------------------------- /Slides/12. Registros.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Slides/12. Registros.pptx -------------------------------------------------------------------------------- /Slides/13. Uniões e Enumerações.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Slides/13. Uniões e Enumerações.pptx -------------------------------------------------------------------------------- /Slides/14. Ponteiros.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Slides/14. Ponteiros.pptx -------------------------------------------------------------------------------- /Slides/15. Alocação Dinâmica de Memória.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Slides/15. Alocação Dinâmica de Memória.pptx -------------------------------------------------------------------------------- /Slides/16. Laço de Repetição For.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Slides/16. Laço de Repetição For.pptx -------------------------------------------------------------------------------- /Slides/17. Aplicações do Laço For.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Slides/17. Aplicações do Laço For.pptx -------------------------------------------------------------------------------- /Slides/18. Laços de Repetição While e Do-While.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Slides/18. Laços de Repetição While e Do-While.pptx -------------------------------------------------------------------------------- /Slides/19. Aplicações dos Laços de Repetição.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Slides/19. Aplicações dos Laços de Repetição.pptx -------------------------------------------------------------------------------- /Slides/20. Instrução de Desvio If.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Slides/20. Instrução de Desvio If.pptx -------------------------------------------------------------------------------- /Slides/21. Operadores Lógicos.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Slides/21. Operadores Lógicos.pptx -------------------------------------------------------------------------------- /Slides/22. Instrução de Desvio Switch.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Slides/22. Instrução de Desvio Switch.pptx -------------------------------------------------------------------------------- /Slides/23. Arquivos Texto.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Slides/23. Arquivos Texto.pptx -------------------------------------------------------------------------------- /Slides/24. Arquivos Binários.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Slides/24. Arquivos Binários.pptx -------------------------------------------------------------------------------- /Slides/25. Funções com Vetores.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Slides/25. Funções com Vetores.pptx -------------------------------------------------------------------------------- /Slides/26. Funções com Strings e Registros.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Slides/26. Funções com Strings e Registros.pptx -------------------------------------------------------------------------------- /Slides/27. Funções Inline e Ponteiros para Funções.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Slides/27. Funções Inline e Ponteiros para Funções.pptx -------------------------------------------------------------------------------- /Slides/28. Armazenamento e Referências.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Slides/28. Armazenamento e Referências.pptx -------------------------------------------------------------------------------- /Slides/29. Templates e Sobrecarga de Funções.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Slides/29. Templates e Sobrecarga de Funções.pptx -------------------------------------------------------------------------------- /Trabalhos/TP1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Trabalhos/TP1.pdf -------------------------------------------------------------------------------- /Trabalhos/TP2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Trabalhos/TP2.pdf -------------------------------------------------------------------------------- /Trabalhos/TP3.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/Trabalhos/TP3.pdf -------------------------------------------------------------------------------- /VisualStudio.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JudsonSS/ProgComp/61702b145a19c06ac7b9401e06efefd399505927/VisualStudio.pdf --------------------------------------------------------------------------------