# dividing by any numbers = 4354302

• (2 Pages)
• 1
• 2

## 22 Replies - 1530 Views - Last Post: 03 February 2018 - 07:27 PMRate Topic: //<![CDATA[ rating = new ipb.rating( 'topic_rate_', { url: 'https://www.dreamincode.net/forums/index.php?app=forums&module=ajax&section=topics&do=rateTopic&t=409100&amp;s=e9cc262a6fc3632494aae5e5597252e6&md5check=' + ipb.vars['secure_hash'], cur_rating: 0, rated: 0, allow_rate: 0, multi_rate: 1, show_rate_text: true } ); //]]>

### #16 tony jay

• D.I.C Head

Reputation: 18
• Posts: 50
• Joined: 31-January 18

## Re: dividing by any numbers = 4354302

Posted 03 February 2018 - 05:28 PM

Full marks for effort then!

What are you using for reference - obviously C++ as more than a few ins and outs - as you are discovering.
Was This Post Helpful? 0

### #17 kianyt

• New D.I.C Head

Reputation: 0
• Posts: 17
• Joined: 03-February 18

## Re: dividing by any numbers = 4354302

Posted 03 February 2018 - 05:48 PM

I've been following along this guide, but stopped after 2 hours and i'm just trying some exercises to make sure i remember, and come across a few things that i hadn't been taught yet and thought id ask here.

https://www.youtube....qmKlLY&t=3202s#
Was This Post Helpful? 0

### #18 kianyt

• New D.I.C Head

Reputation: 0
• Posts: 17
• Joined: 03-February 18

## Re: dividing by any numbers = 4354302

Posted 03 February 2018 - 06:00 PM

started yesterday
Was This Post Helpful? 0

### #19 tony jay

• D.I.C Head

Reputation: 18
• Posts: 50
• Joined: 31-January 18

## Re: dividing by any numbers = 4354302

Posted 03 February 2018 - 06:02 PM

No problem with YouTube videos per se.
Very useful for those that have an AV approach to learning.

However you will also need a real reference to consult.
Something that fills in the gaps.

This site is excellent: www.cplusplus.com/reference/
It also has tutorial and forum components, however the technical reference is excellent and the main reason that I consult it.

If you are planning a tertiary education in CS or software engineering and you want to continue with C++ then consider a good university-level textbook on C++. I can recommend a few if required. Most of them are available as Kindle versions as well.
Was This Post Helpful? 1

### #20 kianyt

• New D.I.C Head

Reputation: 0
• Posts: 17
• Joined: 03-February 18

## Re: dividing by any numbers = 4354302

Posted 03 February 2018 - 06:03 PM

ok thanks, will take a look
Was This Post Helpful? 0

### #21 tony jay

• D.I.C Head

Reputation: 18
• Posts: 50
• Joined: 31-January 18

## Re: dividing by any numbers = 4354302

Posted 03 February 2018 - 06:09 PM

kianyt, on 03 February 2018 - 06:00 PM, said:

started yesterday

Yup, a fair way to go then!

However, your approach is valid in the sense that the best way to learn is to actually program.
One thing to bear in mind though is that any solution that can be coded in C++ has to explainable first in English (or whatever language you like).
What this means is that in order to code the solution one has to understand, step-by-step, what the solution is.
Usually, this makes the actual coding rather trivial.
I do understand that you are still learning the semantics of C++ and in many ways your biggest problem, currently, is simply getting a program to compile and correctly run with simple logic, but very quickly it just becomes a tool for expressing solutions to problems!
Was This Post Helpful? 1

### #22 kianyt

• New D.I.C Head

Reputation: 0
• Posts: 17
• Joined: 03-February 18

## Re: dividing by any numbers = 4354302

Posted 03 February 2018 - 06:37 PM

Here is the final code, would you be able to tell me anything that i should start doing or stop doing just to get into the habit?

```#include <iostream>
#include <cstdlib>
#include <iomanip>

using namespace std;

int main()
{
int positiveOriginal;
int totalReviews;
int positiveReviews;
float percentagePositive;

cout << "Please Enter your total reviews" << endl;
cin >> totalReviews;
cout << "Please Enter your positive reviews" << endl;
cin >> positiveReviews;
positiveOriginal = positiveReviews;

percentagePositive = (float)positiveReviews / (float)totalReviews;

if (positiveReviews <0.9*totalReviews)
{
cout << "Your percentage of positive results is " << percentagePositive*100 << endl;
while (positiveReviews <=0.9*totalReviews)
{
positiveReviews++;
totalReviews++;
}

cout << "You need " << positiveReviews - positiveOriginal << " more Positive Reviews to get a percentage of over 90% positive" << endl;
}else{
cout << "Congratulations, you already have a positive percentage of 90% or higher" << endl;
}
return 0;
}

```

Was This Post Helpful? 0

### #23 tony jay

• D.I.C Head

Reputation: 18
• Posts: 50
• Joined: 31-January 18

## Re: dividing by any numbers = 4354302

Posted 03 February 2018 - 07:27 PM

I think that you are doing just fine!

The way to learn a language (this goes for Mandarin or Spanish as much as it does for C++) is to use it as much as possible.
Gradually, new ways of doing things become apparent, sometimes the new ways are actually simpler than what you first learned, but you will also find the growing ability to tackle problems that are not only more complicated in themselves but require more sophisticated understanding of C++.

Very few individuals completely understand C++. It is not necessary to know every obscure corner of C++ and the Standard Library to be a bona fide expert in C++. You have already discovered that it is possible solve problems and write programs using only a very limited subset of the language - do not underestimate the importance of this discovery!
I assume that English is your home language (If it is not just substitute the correct language). How many of use really understand all that much about the grammar of English, never mind all the vocabulary of English! Yet, we are comfortable speaking, writing, and using English despite the fact that few of us could pass an exacting university-level exam on English grammar. Moreover, how did we get to be able to speak, read, write, and use English? By just using it! And, in every day of use, we learned more and more about the grammar and vocabulary that enabled us to become better at it. Most of us cannot give an adequate technical definition of what an adverbial participle is or a subjunctive clause yet we use them all the time!
(Now in C++, once one has become well familiar various C++ constructs it is well worthwhile to go back after a time figure what is going on under the hood, but it is not necessary to know everything that is going on under the hood prior to using that construct in the first place.)

Reading C++ comes a close second to writing C++ as a learning opportunity. So find code fragments to read that have been coded by others. Even learning how to read C++ is a skill in itself.

About the only caution I would give you is to be aware that C++ has been around about 40 years. During that time it has undergone significant revision. So, in learning the syntax of C++ makes sure that you are learning modern C++, that is C++11 and newer.
It is not just about a few new keywords and library facilities but also how one approaches programming in modern C++. A good example would be the use of pointers. Modern C++ encourages the use of smart pointers rather than traditional pointers in open code.
I understand that it will take a while before this titbit becomes really relevant to you.
Also, many individuals teach C++ as a modern version of C instead of concentrating on what distinguishes C++ from C.
A good example example here would teaching arrays (based on C) instead of introducing vector (a standard library feature) as the practical de facto go-to data container. (Later on, once one has some expertise with C++ one can go back and play with C-style arrays and use them to implement a vector class.)
So be cautious of books, or YouTube video tutorial series, that really just teach C in the guise of C++.

Otherwise you have made a good start, just remember that real ability in C++, in particular, and programming, in general, takes years of consistent effort.
Was This Post Helpful? 1

• (2 Pages)
• 1
• 2

 .related ul { list-style-type: circle; font-size: 12px; font-weight: bold; } .related li { margin-bottom: 5px; background-position: left 7px !important; margin-left: -35px; } .related h2 { font-size: 18px; font-weight: bold; } .related a { color: blue; }