Hi guys! I’m a new student of dev C++. I want to learn some of its basic fundamentals.
A sample code here is to be corrected:
include <iostream>
using namespace std;
int main ()
{
back:
int age,bday,year;
year = 2007;
cout << “How old are you? \n“;
cin >> age;
if (age != ‘int’) {
cout << “Please enter numeric value!\n”;
goto back;
}
bday = year – age;
cout << “You were born in” <<bday;
return 0;
}
I need you to repair these codes. I want these codes when you enter your age,
It should be a numeric value, if not, I want it to leave a message asking for a numeric value for age, and ask again for his age. If it enters numeric value for age, then it will just
Simply display the year you were born. Thank a lot!...
Great corrections will be heartily appreciated…
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
What are the different types of classes used for
object-oriented programming in C++?
Why is my Dev-C++ failed to compile and brings out a pop-up
window which is a "riskware"?and if you'll going to quarantine
or terminate and then compiles again, it will leave a message,
"The system cannot find the path for a specified file".
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2007-08-19
It seems to me that you don't want to learn anything at all; otherwise you would have paid attention in class!
However I will teach you a few fundamentals:
1) It is "repair this code" NOT "repair these codes".
2) No one is a "student of dev C++", "C++" perhaps, but not "Dev-C++". That's like saying: "I am learning to use the Dell Insporion 6000" rather than "I am learning to use a PC".
3) "goto" is IMO only supported in C/C++ for historical reasons (probably to make it easy to port unstructured Fortran code). It has no place in any code you should ever write.
Clifford
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
sorry guyz!about those codes but im just trying to find some solution to make it work regarding on the statements above that
i want to happen.i need a correction,not a comment, but if you
can't make it,still fine,it's ok.thankz....!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi guys! I’m a new student of dev C++. I want to learn some of its basic fundamentals.
A sample code here is to be corrected:
include <iostream>
using namespace std;
int main ()
{
back:
int age,bday,year;
year = 2007;
cout << “How old are you? \n“;
cin >> age;
if (age != ‘int’) {
cout << “Please enter numeric value!\n”;
goto back;
}
bday = year – age;
cout << “You were born in” <<bday;
return 0;
}
I need you to repair these codes. I want these codes when you enter your age,
It should be a numeric value, if not, I want it to leave a message asking for a numeric value for age, and ask again for his age. If it enters numeric value for age, then it will just
Simply display the year you were born. Thank a lot!...
Great corrections will be heartily appreciated…
What are the different types of classes used for
object-oriented programming in C++?
Why is my Dev-C++ failed to compile and brings out a pop-up
window which is a "riskware"?and if you'll going to quarantine
or terminate and then compiles again, it will leave a message,
"The system cannot find the path for a specified file".
(1) The kind that work, and the kind that don't
(2) Poltergeist phenomenon, or an imbalance in the matter/anti-matter ratio
leading to a temporal rift that trips your anti-viral software.
I am sure your teacher will love those answers.
Wayne
Why is my homework alarm bell going off?
Wayne
LOL, it has a goto statement.
It seems to me that you don't want to learn anything at all; otherwise you would have paid attention in class!
However I will teach you a few fundamentals:
1) It is "repair this code" NOT "repair these codes".
2) No one is a "student of dev C++", "C++" perhaps, but not "Dev-C++". That's like saying: "I am learning to use the Dell Insporion 6000" rather than "I am learning to use a PC".
3) "goto" is IMO only supported in C/C++ for historical reasons (probably to make it easy to port unstructured Fortran code). It has no place in any code you should ever write.
Clifford
sorry guyz!about those codes but im just trying to find some solution to make it work regarding on the statements above that
i want to happen.i need a correction,not a comment, but if you
can't make it,still fine,it's ok.thankz....!
That is by far the most bizarre attempt at C++ I've seen.
"i need a correction,not a comment"
Don't worry; the comments are on the house.
Soma
Notice that he did not deny it is homework.
Wayne
if (age != ‘int’) {
Would that actualy work?
and should put the label back: after the variable declarations,
though a loop is better.
theres my 2 cents of utter crap.
Don't bother to respond, he won't understand. He repeated the same grammatical error right after I corrected it in point (1).
Clifford