[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
I want to get better at C++. Could you guys suggest good problems/projects
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 27
Thread images: 4
File: languages.png (135 KB, 620x258) Image search: [Google]
languages.png
135 KB, 620x258
I want to get better at C++. Could you guys suggest good problems/projects I could do to pracitce programming?
>>
Learn C instead
>>
make vidya gaems
>>
File: Capture.png (7 KB, 995x120) Image search: [Google]
Capture.png
7 KB, 995x120
You are the owner of a hardware store and need to keep an inventory that can tell you what different tools you have, how many of each you have on hand, and the cost of each one.
Part 1
Implement the class Record that contains the following private and public members

private:
int recordNum;
char toolName [25];
int quantity;
double cost;

public:
void setRecordNumber(int);
int getRecordNumber() const;

void setToolName(string);
string getToolName() const;

void setQuantity(int);
int getQuantity() const;

void setCost (double);
double getCost() const;


Part 2
Write a program for the hardware store with the following functionalities (develop as a menu-driven application):
Function 1: initializeFile
This function initializes the random-access file hardware.dat to 50 empty records.

Function 2: addDataToFile
This function allows the user to input data concerning each tool. See sample below
Function 3: displayFileContent
This function will display the list of tools stored in the hardware.dat file.
Function 4: deleteRecordFromFile
This function will delete a record for a tool that you no longer have in stock.
Function 5: updateRecord
This function will be used to update the quantity on hand. If the hardware store sells an item, you should decrement the quantity, and vice versa, if new stocks are added. Make provisions for these transactions in this function
>>
File: 91i+g38v9eL._SL1500_.jpg (229 KB, 1143x1500) Image search: [Google]
91i+g38v9eL._SL1500_.jpg
229 KB, 1143x1500
>>51632203
Try to write a web server or a basic browser
>>
>>51632396
>You are the owner of a hardware store
this reads like those dumb real-life maths questions
>>
Write a Circle class that has the following member variables:

• radius: double
• pi: a double initialized with the value 3.14159

The class should have the following member function:
• Default constructor: A default constructor that sets radius to 1.0

• Constructor: Accepts the radius of the circle as argument. You are required to use exception handling techniques as discussed in class, if a user enters 0.0 for the radius, throw an exception informing the user that the radius cannot be 0.0 and allow them to enter a new value.

• setRadius: A mutator function for the radius variable

• getRadius: An accessor function for the radius variable

• getArea: Returns the area of a circle, which is calculated as area = pi* radius * radius.

• getDiameter: return the diameter of the circle, which is calculated as radius * 2.

• getCircumference: returns the circumference of the circle, which is calculated as circumference = 2 * pi * radius.

You are required to demonstrate your class in a driver program.

Deliverables: Circle.h, Circle.cpp, tester.cpp, ZeroException.h
>>
>>51632447
>>51632396
this shit is srsly so trivial wtf i was never given tasks like this for my course
>>
Write a class named Car that has the following member variables.

• yearModel. An int that holds the car’s year model.
• make. A string that holds the make of the car.
• speed. An int that holds the car’s current speed.


In addition, the class should have the following constructor and other member functions

• Constructor. The constructor should accept the car’s year model and make as arguments. These values should be assigned to the object’s yearModel and make member variables. The constructor should also assign 0 to the speed member variables.
• Accessors. Appropriate accessor functions to get and set the values stored in an object’s yearModel, make, and speed member variables.
• accelerate. The accelerate function should add 5 to the speed member variable each time it is called.
• brake. The brake function should subtract 5 from the speed member variable each time it is called.


Demonstrate the class in a program that creates a Car object, and then calls the accelerate function five times. After each call to the accelerate function, get the current speed of the car and display it. Then, call brake function five times. After each call to the brake function, get the current speed of the car and display it.

Knock yourself out, OP.
>>
>>51632485
I got them as practice exercises/assignments in college. This was a first year programming course, so you can understand why.
>>
>>51632496
if we're just posting our college assignments op can do this
https://www.cl.cam.ac.uk/teaching/1415/CandC++/exsheet.pdf
your college assignments look so annoying and wordy
>>
>>51632422
is this book good?
>>
>>51632538
before you get a book follow some uni's course on it
books are just for when you get stuck imo
>>
Stanford has C++/OOP Java programming courses
https://see.stanford.edu/Course

Take those 3 courses. First is a Java course that teaches OOP bullshit, because everything in C++ like game studios is object oriented.

Next course you build on first and learn C++ exclusively, then in third you learn compiler and memory management for C/C++

After that can just get any book on C/C++
>>
>>51632536

Were you asked to write actual programs?
>>
>>51632706
we had a slightly bigger exercise
https://www.cl.cam.ac.uk/teaching/1415/CandC++/C-prog-exercise.pdf
but these exercises are mostly to ensure you understand the details of the actual languages c/c++ (so you dont fuck up), not aiming to teach you to make a car object
if by writing programs you mean oop stuff, it was mostly in a course we did in first year
https://www.cl.cam.ac.uk/teaching/1415/OOProg/
(done in java so you dont get fucked up by all the stuff you can do wrong in c/c++)

and we had labs for actually making something
https://www.cl.cam.ac.uk/teaching/1415/ProgJava/
https://www.cl.cam.ac.uk/teaching/1415/FJava/materials.html
>>
>>51632806
btw i agree with >>51632565
just follow the stanford courses
>>
hello saif, tru gentoo
>>
>>51632396
solution!!
>>
File: 1422476539461.png (305 KB, 1920x1080) Image search: [Google]
1422476539461.png
305 KB, 1920x1080
>>51632203
>>
>>51634088
interesting, gonna try it.i assume languages/technologies are on us to decide?
>>
>>51632447
>>51632488

>Please do my homework for me
>>
>>51632203
implement a small paint software which has seam carving
>>
>>51632203
Find a problem or project first. Then decide on the language.
>>
>>51632203
Take projects you've written in languages you already know and port them into C++.
>>
>>51632538
his books are pretty good.
That guy that is responsible for the D language also has a pretty good book too. I think he's romanian or something, you'll see by the name, but it's easy to find
>>
>>51634287
you should chose the language and technologies according the project your working on. That's part of the challenges
Thread replies: 27
Thread images: 4

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.