Giter Site home page Giter Site logo

stroustrup-ppp's People

Contributors

chrinkus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

stroustrup-ppp's Issues

Chapter 2 file naming

Change chapter 2's file names and notes.md layout to reflect current conventions.

Chapter 6 file naming

Continue work with standardizing repo file names. If any exercises need to be completed or extra work is required, open a specific issue.

Chapter 9 file naming

Continue work with standardizing repo file names. If any exercises need to be completed or extra work is required, open a specific issue.

Refine the Grammar concept

Add a grammar.md file to dissect the provided concept by the chapter. Come up with a few example implementations.

Chapter 8 file naming

Continue work with standardizing repo file names. If any exercises need to be completed or extra work is required, open a specific issue.

Complete Chapter 9 Chrono

It is tempting to refactor most of this chapter's work but the exercises were completed and the painful-to-take-credit-for code will remain. The Chrono implementation can be fixed up though as it comes from the textbook and I hadn't attempted ex 11 & 12 which are enhancements.

Complete Chapter 7 Exercises

I'm moving on from Chapter 7 as the remaining exercises are worthwhile but I'm wanting to get into Chapter 8 ASAP. Come back and finish up the simple calculator at a later time.

Chapter 21 Exercise 7 Fix

I'm learning C++ and like to use your github to check my work/improve. Overall it is very well done and thank you for sharing!

The issue in your bin_lst() function is that it will not check against the exactly middle or exactly last element in a container.
So if you have a list{1,2,3,4,5,6,7,8,9,10}; , the function will not find 5 or 10. If you add the following code, it should work better. Your bin_lst() function will also work directly with vector as well.

I'm new to Github, so sorry if my formatting is subpar. If you add :


if (half == 0 && *(--last) == val)
        return last;

just after the loop at line 60, it will fix your code. It's the best I can manage, so I'm not sure if there's a better solution.

`template<typename Iter, typename T>
Iter bin_lst(Iter first, Iter last, const T& val)
{
auto half = std::distance(first, last);
auto end = last;

while (first != last && half != 0) {
    if (*first == val) return first;

    half /= 2;
    auto mid = first;
    std::advance(mid, half);
    *mid > val
        ? std::advance(last, -half)
        : std::advance(first, half);
}

//loop exits when half = 0
//but last value wasn't checked
if (half == 0 && *(--last) == val)
return last;

return end;

}`

Complete Chapter 6 Calculator

Chapter 6's 'try this's focus on using intermediate versions of the calculator. Implement clearer examples of them with correct file names. Consider a better way to execute some of the added calculator features found in the exercises rather than having several different calculators with different features.

Chapter 10 file naming

Continue work with standardizing repo file names. If any exercises need to be completed or extra work is required, open a specific issue.

Chapter 3 file naming

Most of chapter 3 follows the general naming conventions with the exception of the 'try this's. Review the code for completion.

chapter4 number guesser

Hi .
While i was doing chapter 4 number guesser exercise i got stuck and check your answer to get and idea about structure.While i was controlling if your guesser was right i found its mostly right but it didnt guess 50.
I fix problem later but wanted to let you know about it .Thanks for your work.

/* Write a program to play a numbers guessing game.
The user thinks of a number between 1 and 100 and your program asks questions to figure out what the number is (e.g., β€œIs the number you are thinking of less than 50?”).
Your program should be able to identify the number after asking no more than seven questions.
Hint: Use the < and <= operators and the if-else construct. */
#include
#include
#include
#include
#include
#include <stdio.h>
using namespace std;
int main() {
double base{ 50 };
double fuck{ 50 };
char choice{};
cout << "is your number bigger than " << fuck;
cout << "\n Y/N\n";
for (int i{ 0 };i <=5;i++) {
cin >> choice;
fuck = fuck / 2;
if (base <= 1)
base = 1;
if (choice == 'y' || choice == 'Y') {
base += fuck;
cout <<"is your number bigger than "<<base<<" Y/N\n";
}

		if (choice == 'n' || choice == 'N') {
			base -= fuck;
				cout<< "is your number bigger than " << base << " Y/N\n";
		}

		
}
cout << "is your number even? Y/N";
	int x=base;
char en{};
cin >> en;
if (en == 'y' || en == 'Y')
	cout << "Your number is " << x + 1;
else
	cout << "your number is " << x;

}

Chapter 4 file naming

Continue work with standardizing repo file names. If any exercises need to be completed or extra work is required, open a specific issue.

Calculator.cpp example issue : Non-void function does not return a value in all control paths

non-void function does not return a value in all control paths

I was doing the calculator problem in chapter 8 (Exercise 1) when I ran into this problem. The problem is in the definition of the function Token_stream::get(). I used Xcode for this exercise.
The error showed by Xcode is Non-void function does not return a value in all control paths. It does not provide anything else. From what I understand, there could be a scenario when the get() function won't go through any of the switch-cases which could cause problems. Although I haven't been able to find the solution to this problem.
I would appreciate if this issue is addressed.

P.S. I used the same code from the solutions in this project. So I am sure that there are no syntax errors.

Chapter 11 file naming

Continue work with standardizing repo file names. If any exercises need to be completed or extra work is required, open a specific issue.

Chapter 7 file naming

Continue work with standardizing repo file names. If any exercises need to be completed or extra work is required, open a specific issue.

Chapter 21 Exercise 7

It also seemed quite strange to me that we're asked to implement a binary search for a List in this question. It definitely feels like it should come with a warning as it seems like a fairly rare case for there to be a comparison operation which would be more expensive than repeatedly traversing through a bi-directional iterator!

I hope you don't mind me asking whether you've had many encounters where this is the case since working through these exercises?

According to an article I read 'binary search through a linked list' is almost a bit of an geeky joke for developers in the know!

On the whole, I'm sure you'd agree 21 was a pretty dazzling chapter! Definitely brought a lot of things together for me.

As a side note, I'm really interested to hear about your experiences since working through this book, where programming has lead you and what your aspirations are!

I started studying C++ around 6 months ago but I've been learning computer languages for several years now and I'm working towards becoming a video games developer.

I haven't actually had much contact with other developers and have never worked in any sort of software development position so any insight you could offer would be really appreciated!

If you don't mind sharing some of your experiences perhaps it'd be better via email? You can reach me at [email protected]

Chapter 5 file naming

Continue work with standardizing repo file names. If any exercises need to be completed or extra work is required, open a specific issue.

Complete Chapter 8 Exercises

Exercises 12 and 14 were omitted but should not have been.

Also, exercise 1 is a further enhancement of the calculator from chapters 6 & 7. Update it when 6 and 7 are completed.

Complete Chapter 10 Calculator Ex

Exercises 7 and 10 add enhancements to the calculator from chapters 6 & 7. Complete these when all of the preceding chapters have had their enhancements bolted on to the calculator.

Complete Chapter 11 Exercises

Exercises 7 and 8 build on 6 and were omitted on my first pass. Admittedly, they are a bit excessive but shouldn't pose too much of a problem to complete.

Chapter 23 Ex15

I came up with mathematical patterns such as factorials and fibonacci sequences for this one (which segues quite nicely into the postscript for that chapter...).

Whether or not those sorts of patterns can actually be expressed as regex is beyond me.

I did see a couple of blog posts, particularly from a guy under the name 'Polygenelubricants', which seemingly managed to express those sorts of patterns with regex. Even so, it really doesn't seem to be the most practical way to express them.

Chap 20 Ex04 JackAndJill

Hi Chrinkus,

I've recently been working through this textbook and it's been super useful to have something to check my answers against. Thanks so much for posting all of this!

I think the big error in Exercise 4 Chapter 20 might be that there's no check as to whether the start iterator actually comes before the end iterator. If someone accidentally entered them in reverse into the function's arguments, it would lead to an infinite loop.

template<typename Iter>
Iter high(Iter first, Iter last) {
	if (first > last) throw; //Could lead to infinite iterations
	Iter high = first;
	for (Iter p = first; p != last; ++p) {
		if (*high < *p) { high = p; }
	}
	return high;
}

Not sure what it might be otherwise...

Cheers,

Josh

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.