📚 Learn how to solve problems and build projects with these Free E-Books ⬇️ C++ Lambdas e-book - free download here: bit.ly/freeCppE-Book Entire Object-Pascal step-by-step guide - free download here: bit.ly/FreeObjectPascalEbook 🚀📈💻🔥 My Practical Programming Course: www.codebeautyacademy.com/ Experience the power of practical learning, gain career-ready skills, and start building real applications! This is a step-by-step course designed to take you from beginner to expert in no time! 💰 Here is a coupon to save 10% on your first payment (CODEBEAUTY_YT10). Use it quickly, because it will be available for a limited time. #include using namespace std; void main() { int grade, sum = 0; for (int i = 0; i < 3; i++) { do { cout
I am having trouble getting your code to run. I copy and paste the code above and then get the following error message: C:\Users\mark_\myCppprograms>c++ nested_loops_codebeauty_her_code.cpp -o nested_loops_codebeauty_her_code.exe nested_loops_codebeauty_her_code.cpp:6:11: error: '::main' must return 'int' void main()
@@rudebee15 i was going to ask the same question and as I saw you already did I think the answer kind of came to me. I think there is a function similar to the setw( )function. Not totally sure what it is but I bet a Google search would find it quickly. You would need the necessary header file too.
One important lesson I have learnt from your videos is not to try to memorize code but to first fully understand the problem and the steps to solve it. And then translate that into code.
Just writing this to make sure I understood. So, for an i variable that is between 0 and 2, the program will prompt the user to enter a grade whose "order" number is that of the i variable + 1. If I understood correctly the program won't register this as an increment, but rather this is used for display purposes only (i.e the i variable starts at 1 in the cout prompt, but for all other purposes it actually starts at 0, then 1, then 2). So after that, the program checks if the grade variable has a value below 1 and above 5, and if so it will prompt the user to input the grade again without incrementing the i value. This is happening because the program can't return to the for loop while this condition is true. When it's not true (i.e values between 1 and 5) the program returns to the for loop, increments i by 1 and asks for the next grade. So that while loops exists really just to make sure the user doesn't cheat and enter whatever values they want.
Thanks Kevin :D You can right click on the console window, click Properties and there you can change font, colors, layout... When it comes to the second part of your question, you can google "Shortcut tips for Visual Studio 2019", and there you can find a lot of useful shortcuts :smile:
Hi, this means that the program is going to ask you to enter a grade again if it's lower that 1 or higher than 5 - this condition makes sure the program only accepts grades that are {1,2,3,4,5}. The sign "||" stands for "or".
I rewrote this program so the user can input grades as letters from A* to F, it then converts them to numbers, takes the average, then spits back out a letter grade. There's probably a more efficient way of doing it than just using a bunch of if statements, but this was the only way I could think of that worked. Here's my code: #include #include using namespace std; int main() { string gradeLetter; int gradeNum, loopCounter, sum=0; cout loopCounter; for(int i=0; i
OK, I don't understand American grading system. Can you explain me the difference between A and A*, also what every letter represent? Where I come from 5 is the best grade you can get and 1 is the worst, so how would you compare it to our grading sys so that I could understand your code better.
if you want to limit the amount of if statements then maybe try formatting it using case statements, same thing but more efficient i think for what you are trying to do!
you could put either, but that "int" or "void" is if you are returning a value somewhere you use that to determine what the return data type is. If you look at her last video, say you put the factorial code into a function called "Factorial" and you want to return a value, you'd say "int Factorial" but in this case, the main method returns no value so you can use void. She uses int in other cases and that's not inherently wrong, but she doesn't actually return anything.
whats the propose of Avg ? idk maybe schools are different in other countries or maybe i just never noticed the avg grade or didn't care i don't know pls explain :)
We are using "for (int i = 0; i < 3; i++)" and its loops 3 times but code never rewrite "int i=0" after each loop, i cannot understand the logic because code do not store any data after i++
I transformed 'grade' and 'sum' into floating point type variable (float) instead of integer variable (int) so that: 1) I may enter grades with decimals 2) I don't need to turn them into (float) or decimal to do the average. Thank you so much for your videos. You make learning a pleasure. (And the bloopers were very funny)
Hi Alexandra, I think the original solution from the author is better since you don't get a 1.5 grade but 1 or 2 and hence the sum can only be a whole number (1+2=3). However, the average may be a decimal number so it makes sense to go for a variable data type that can hold a decimal value.
Sorry I correct my previous phrase and the correct is ; So if the grade is different from 76 or 73, the program must runs to the same Etapa. And when I enter the 76 or 73 the program must to run to the next level of Etapa because do not meet the condition of while to repeat the same level of Etapa. ..and pass to the next level of Etapa.. in my conception ..but is not working. The loop continua with the same Etapa that means is stoped at previous Etapa. So I do not understand where I mistake. All the best
The reason your code does not work is because, first.) the do-while loop is suppose to continue to loop if the user has not entered a correct value. For her program, In this case, it will continue to ask the user for a grade until they enter a valid grade, the outer loop will then increment once the correct value is entered. Your loop says if they enter a value greater than or equal to 1 or less than or equal to 5, continue to do the "do." Try entering a negative value or a value greater than 5, 3 times, it will increment 3 times and exit the loop because the condition is not being met.
I didnt used nested loops,I just used one loop and made the same program..... #include int main() { int grade, sum = 0; for (int i = 0;i < 3;) { std::cout 0&&grade
📚 Learn how to solve problems and build projects with these Free E-Books ⬇️
C++ Lambdas e-book - free download here: bit.ly/freeCppE-Book
Entire Object-Pascal step-by-step guide - free download here: bit.ly/FreeObjectPascalEbook
🚀📈💻🔥 My Practical Programming Course: www.codebeautyacademy.com/
Experience the power of practical learning, gain career-ready skills, and start building real applications!
This is a step-by-step course designed to take you from beginner to expert in no time!
💰 Here is a coupon to save 10% on your first payment (CODEBEAUTY_YT10).
Use it quickly, because it will be available for a limited time.
#include
using namespace std;
void main()
{
int grade, sum = 0;
for (int i = 0; i < 3; i++) {
do {
cout
I am having trouble getting your code to run. I copy and paste the code above and then get the following error message:
C:\Users\mark_\myCppprograms>c++ nested_loops_codebeauty_her_code.cpp -o nested_loops_codebeauty_her_code.exe
nested_loops_codebeauty_her_code.cpp:6:11: error: '::main' must return 'int'
void main()
@@Hylocichla Try this 😊
Instead of having void main(), write int main()
And before your last "}" put
return 0;
I can get your code to run if I change one line:
// void main()
int main()
how do you set the decimal point to two decimals only?
@@rudebee15 i was going to ask the same question and as I saw you already did I think the answer kind of came to me. I think there is a function similar to the setw( )function. Not totally sure what it is but I bet a Google search would find it quickly. You would need the necessary header file too.
She is that teacher you will fall in love with!
One important lesson I have learnt from your videos is not to try to memorize code but to first fully understand the problem and the steps to solve it. And then translate that into code.
This is the best advice that will help you to learn programming! ☺️
This channel helped me a lot. The only woman who makes coding more understandable .
woman .....?? Really ..... ? You have no respect for your mentor ??
You made me smile, and you made the rest of the lesson so enjoyable! Did you make a course blooper reel? I'd enjoy seeing more funny out-takes!
several days ago, I was like why learning programming is so cold to learn? and then I arrived here. you make it more human
Thank you so much!! I was able to finish my project because of you. :')
Just writing this to make sure I understood.
So, for an i variable that is between 0 and 2, the program will prompt the user
to enter a grade whose "order" number is that of the i variable + 1. If I understood correctly the program won't register this as an increment, but
rather this is used for display purposes only (i.e the i variable starts at 1 in the cout prompt, but for all other purposes it actually starts at 0,
then 1, then 2). So after that, the program checks if the grade variable has a value below 1 and above 5, and if so it will prompt the user to input the grade again without incrementing the i value. This is happening because the program can't return to the for loop while this condition is true. When it's not true (i.e values between 1 and 5) the program returns to the for loop, increments i by 1 and asks for the next grade. So that while loops exists really just to make sure the user doesn't cheat and enter whatever values they want.
Correct 😊
how do you make the font bigger or smaller? what quick tabs do you use? love your videos btw!
Thanks Kevin :D
You can right click on the console window, click Properties and there you can change font, colors, layout...
When it comes to the second part of your question, you can google "Shortcut tips for Visual Studio 2019", and there you can find a lot of useful shortcuts :smile:
thanks ,your train is good
First time making a intro!!! So funny xD
Hi I didn't understand why you have used
while (grade5);
What does grade5 mean?
Hi, this means that the program is going to ask you to enter a grade again if it's lower that 1 or higher than 5 - this condition makes sure the program only accepts grades that are {1,2,3,4,5}. The sign "||" stands for "or".
very nice thank you Ms
I rewrote this program so the user can input grades as letters from A* to F, it then converts them to numbers, takes the average, then spits back out a letter grade. There's probably a more efficient way of doing it than just using a bunch of if statements, but this was the only way I could think of that worked.
Here's my code:
#include
#include
using namespace std;
int main()
{
string gradeLetter;
int gradeNum, loopCounter, sum=0;
cout loopCounter;
for(int i=0; i
OK, I don't understand American grading system. Can you explain me the difference between A and A*, also what every letter represent? Where I come from 5 is the best grade you can get and 1 is the worst, so how would you compare it to our grading sys so that I could understand your code better.
if you want to limit the amount of if statements then maybe try formatting it using case statements, same thing but more efficient i think for what you are trying to do!
thanks
i run the program with both int and void and the result was same
will it be same niversally aswell?
please explain
why we used void main()
What font are you using in this video?
thanks, mam💕💖
Why do we use void instead of int at the beginning??
you could put either, but that "int" or "void" is if you are returning a value somewhere you use that to determine what the return data type is. If you look at her last video, say you put the factorial code into a function called "Factorial" and you want to return a value, you'd say "int Factorial" but in this case, the main method returns no value so you can use void. She uses int in other cases and that's not inherently wrong, but she doesn't actually return anything.
whats the propose of Avg ? idk maybe schools are different in other countries or maybe i just never noticed the avg grade or didn't care i don't know pls explain :)
We are using "for (int i = 0; i < 3; i++)" and its loops 3 times but code never rewrite "int i=0" after each loop, i cannot understand the logic because code do not store any data after i++
It does store data inside 'grade' and 'sum' variables, and it overwrites 'i' because of 'i++' argument.
I transformed 'grade' and 'sum' into floating point type variable (float) instead of integer variable (int) so that:
1) I may enter grades with decimals
2) I don't need to turn them into (float) or decimal to do the average.
Thank you so much for your videos. You make learning a pleasure. (And the bloopers were very funny)
Hi Alexandra, I think the original solution from the author is better since you don't get a 1.5 grade but 1 or 2 and hence the sum can only be a whole number (1+2=3). However, the average may be a decimal number so it makes sense to go for a variable data type that can hold a decimal value.
Sorry I correct my previous phrase and the correct is ;
So if the grade is different from 76 or 73, the program must runs to the same Etapa. And when I enter the 76 or 73 the program must to run to the next level of Etapa because do not meet the condition of while to repeat the same level of Etapa. ..and pass to the next level of Etapa.. in my conception ..but is not working. The loop continua with the same Etapa that means is stoped at previous Etapa.
So I do not understand where I mistake.
All the best
Why do you set I value to be zero
can we write
:while(grade>=1||grade 5);???
i don't understand why my syntax didn't work??
Both does the same work??
The reason your code does not work is because, first.) the do-while loop is suppose to continue to loop if the user has not entered a correct value. For her program, In this case, it will continue to ask the user for a grade until they enter a valid grade, the outer loop will then increment once the correct value is entered. Your loop says if they enter a value greater than or equal to 1 or less than or equal to 5, continue to do the "do." Try entering a negative value or a value greater than 5, 3 times, it will increment 3 times and exit the loop because the condition is not being met.
@@rajk9989 this might be a silly doubt but a number that lies between 1 and 5 should be greater than or equal to1 and less than or equal to 5 right?
#include "pch.h"
#include
using namespace std;
int main()
{
cout
Why do you always use single alphabet when it comes to loop
do {
cout
No, you are adding the value of grade to sum before checking if that value is okay to use.
I didnt used nested loops,I just used one loop and made the same program.....
#include
int main()
{
int grade, sum = 0;
for (int i = 0;i < 3;)
{
std::cout 0&&grade
Comment for Algor
All the mistakes makes you human. *smile*
In some time I will be able to focus on what is the subject of the film ...
Without the specs you look Very pretty 😀
You are so cute @ 0:04.
You are not saying clearly
This channel helped me a lot. The only woman who makes coding more understandable .