Deitel & Deitel - "C How To Program" - solutions to exercises

Related tags

Miscellaneous chtp
Overview

Deitel & Deitel - "C How To Program" - solutions to exercises

Intro

Here you can find my solutions for Deitel & Deitel - "C How To Program".

The code is distributed in the hope that it will be useful, but without any warranty (correctness, safety, etc).

Consider that exercises enumeration is based on italian translation of the book (english 5th edition); likely (I hope) it will be the same for others.

How to contribute

If you wrote an exercise(s) solution(s) that I haven't done, feel free to send it (them) to me. Please, contact me also if you've found any bug in the sources on the web.

  • write your code (variable names, comments, strings etc) in english;
  • please, test your code before sending it: it must work as expected by exercise question;
  • don't, I repeat, don't copy and paste from copyrighted material available online;
  • every solution must be based only on chapter stuff or concepts from previous chapters: not on stuff to be explained yet;
  • do send me files like xx_yy.c (where xx == chapter, yy == exercise_number);
  • tell me if you don't want to be mentioned in the contributors list;
  • I will not specify "who made what". If you want the code paternity to be knowable, put a comment like /*Solution provided by foo*/ or something similar;
  • The solutions will checked be with gcc -Wall -Wextra -ansi -pedantic xx_yy.c and indented with GNU indent.

You are welcome to:

Contributors, so far

Here

Comments
  • doubt

    doubt

    prog:5.19.c(dietel c How to progarm)

    problem:can you please help me find the bug in the following program written by me?please spend 2 minutes for me.I am trying to find the bug since an hour but could not find out.please help me.

    #include<stdio.h> void anyCharacter(int side,char fillCharacter); int main(void) { int side=90; char fillCharacter='*'; anyCharacter(side,fillCharacter); }//end main void anyCharacter(int side,char fillCharacter) { int dummySide=side; for(side=1;side<=dummySide;side++) { for(side=1;side<=dummySide;side++) { printf("%c",fillCharacter); }//end inner for printf("\n"); }//end outer for }//end function fill character

    opened by ghost 3
  • solution to 04_31.c

    solution to 04_31.c

    Regarding your solution to 04_31.

    Editing your code, like below, shows the same result:

    #include <stdio.h>

    int main () {

    int a, b, x, y, step1, step2, counter1 = 4, counter2 = 1;
    for (step1 = 0; step1 < 5; step1++) {
    for (x = counter1; x > 0; x--) {
        printf(" ");
    }
    for (y = 1 + (2 * step1); y > 0; y--) {
        printf("*");
    }
    
    printf("\n");
    counter1--;
    }
    
    for (step2 = 3; step2 > -1; step2--) {
    for (a = counter2; a > 0; a--) {
        printf(" ");
    }
    for (b = 1 + (2 * step2); b > 0; b--) {
        printf("*");
    }
    
    
    printf("\n");
    counter2++;
    }
    
    return 0;
    

    }


    Best Regards.

    opened by LuisCarlosOliveira 0
  • Add some new program

    Add some new program

    I've have added some new program from chapter 4 those are: 4_25, 4_33, 4_37. pls merge this request I am going add all the remaining program which are yet to code later actually I am working on it. :+1:

    opened by dilippuri 1
  • solution to 4-19

    solution to 4-19

    i suggest you add this solution to 4-19

    `#include <stdio.h>

    include <stdlib.h>

    int main() { int product_number,quntity; int total_quntity=0,i; float retial_price,total_retial=0;

    for(i=0;i<7;i++) { printf("Enter product No.: "); scanf("%i", &product_number); printf("enter quantity sold : "); scanf("%d", &quntity);

     total_quntity+= quntity;
    

    switch (product_number) { case 1: retial_price= 2.98_quntity; break; case 2: retial_price= 4.50_quntity; break; case 3: retial_price= 9.98_quntity; case 4: retial_price= 4.94_quntity; break; case 5: retial_price= 6.87*quntity; break;

    } total_retial+= retial_price;

    } printf("retial price is %f\n",total_retial); printf("total quantity is %d",total_quntity);

    return 0;
    

    }`

    opened by mai95 1
  • Update 06_23.c

    Update 06_23.c

    This provides more close to 5 input displacement comand in problem. Ex: 5, 2 moves turtle 2 slots in an atctual direction (Down for exemple): * * T Rest of comands have 1 number only.

    opened by faelbluhm 0
Owner
Luca Braglia
Luca Braglia
I Found these Xenomai 3 exercises I completed and wrote up for a project a few years ago

I Found these Xenomai 3 exercises I completed and wrote up for a project a few years ago. Decided to put it up onto git in case anyone else finds this useful

null 3 Apr 24, 2022
Bank of challenges & solutions from r/dailyprogrammer for people learning to program

DailyProgrammerChallenges This repo contains all of the challenges from r/dailyprogrammer and also scripts used to pull challenges from the subreddit

Freddie Vargus 317 Dec 8, 2022
In this Program, I am using C language and creating All Patterns Program using Switch case

In this Program, I am using C language and creating All Patterns Program using Switch case. It has 15 pattern programs like a pyramid, half pyramid, etc...

Rudra_deep 1 Nov 13, 2021
A program that read a program and output some shit-like code. /se

A program that read a program and output some shit-like code. /se

Xiwon 6 Jun 16, 2022
Inject a DLL into any program using this C++ program

DLL-Injection-Cpp Inject a DLL into any process using this C++ program Installation Go into a folder and open up Command Prompt. In command prompt run

n0 5 Sep 12, 2022
Competitive Programming Implementations, Resources, Solutions, and Tools

In competitive programming contests, one must write computer programs capable of solving clear-cut problems under the given contraints and limits. Most competitive programmers use C++, Java, or Python.

Dong Liu 14 Sep 23, 2021
Learn open source contribution by adding your coding problems solutions here!

Hacktoberfest-2021 Repository created for Hacktoberfest event where beginners can learn to contribute to open-source source. How to contribute Check t

Developer Student Clubs, Vishwakarma Institute of Technology, Pune 12 Nov 2, 2021
A repository for Dsa solutions and approaches 📚📕

Coffee and Code ?? Coffee and Code is a Question Bank that provides solving patterns and resources along with solutions in diffrent language to help y

null 16 Nov 28, 2021
This repo contains solutions to coding questions available online on coding platforms like - Codeforces, Codechef, URI Online Judge, and Hackerrank.

CPP_Soln This repo contains solutions to coding questions available online on coding platforms like - Codeforces, Codechef, URI Online Judge , LeetCod

Rijul Jain 4 Nov 3, 2022
Accepted solutions to the Atcoder Educational DP Contest

atcoder-educational-dp Accepted solutions to the Atcoder Educational DP Contest A - Frog 1 B - Frog 2 C - Vacation D - Knapsack 1 E - Knapsack 2 F - L

Sachin Srivastava 4 Dec 4, 2022
Practice questions for midterm & final (no solutions)

Comp 15 Tufts Reviews Here are some reviews for the COMP15 midterm and final. These are not the official course study guides, but rather written by me

null 1 Nov 3, 2021
🎃 Submit creative FizzBuzz solutions in any language you want! Open for beginners !

?? Hacktoberfest 2021 FizzBuzz Submit creative FizzBuzz solutions in any language you want! TL;DR: We're searching for creative/extraordinary/weird Fi

Shubh4nk 17 Oct 25, 2022
Undergrad Course CS252 Project Solutions

191CV210_CS252_PROJECT Details/Documentation for individual project constituting of the following problem statements from the 10th edition of Silbersc

Chaitanya Shashwat 1 Nov 21, 2021
Solutions to Hackerrank.com practice problems using JAVA, C, Python and MySQL

Solutions to Hackerrank practice problems This repository contains 185 solutions to Hackerrank practice problems. Updated daily :) If it was helpful p

Ankit Seth 1 Dec 28, 2021
Contains Algorithms and Competitive Programming sites solutions (codeforces, codechef, etc.)

✨ hacktoberfest2021 ?? ?? Contributing to hacktoberfest 2021 Welcome to hacktoberfest 2021 Public Repository. ????‍?? A month-long celebration from Oc

null 13 Oct 22, 2022
My ANSI C solutions for Advent of Code.

ansi-adventure My optimized ANSI C solutions for Advent of Code. I tried favoring speed and performance the most here than most advent of code repos.

2 Dec 12, 2021
Shellcode loader written in rust. Strives to evade modern EDR solutions.

Pestilence What is pestilence? Pestilence is a shellcode loader written in rust. It strives to evade modern EDR solutions. How does it work? It loads

Daniil Nababkin 28 Dec 5, 2022
Coding Questions with Solutions

Coding_SkillSet_Topicwise Code the following questions. Please answer the questions in the "AnswerX.cpp" format.. This repositiory is to help begineer

Anshul Agarwal 9 Oct 28, 2022
Modern C++ solutions for Advent of Code 2021

Modern C++ Solutions for Advent of Code 2021 This repository contains solution for the Advent of Code 2021 and serve as base for articles with explana

RNDr. Simon Toth 32 Jan 4, 2023