hi. this is my first post here, my name is jen, someone in my class told me about this site and how helpful all you guys are and im so lost i thought id come try and see if someone can help me understand :(
i dont even know where to start please help :(

"Define a class Area that has two private variable members; units of type string and area_value of type float. Modify the above program to create a dynamic variable of type Area.
-Input from the keyboard the area_value and its units. Compute one-half and one-quarter of the area and display the results with unit.
-Destroy the dynamic variable at the end

-The input of the unit does not have space in it.
-The default unit is Squaremeter and default area value is 0."

here's the "above program"

#include <iostream> 
using namespace std; 
int main () 
{ 
   int *p1; 
   p1 = new int;// Variables created using the new operator are called dynamic variables 
   cout << "Enter an integer \n"; 
   cin >> *p1; 
   *p1 = *p1 + 7; 
   cout << "Your input + 7 = " << *p1 << endl; 
   delete p1;// Delete the dynamic variable p1 and return the memory
   return 0; 
}

and heres the given class definition

class Area
{
public:
	Area();
 	void setu(string a);
 	void seta(float b);
 	string getu();
 	float geta();
private:
 	string unit;
 	float area_value;
};

Add functions to your class declaration that will get the area and get the unit values and return those values when called.

In main() instead of declaring a variable of type int dynamically, declare a variable of type Area dynamically. Use the set() functions to set the units and area_value member values. display the results of the calculations like this:

cout << "one half the area is" << (AreaObject->geta())/2 << //display units

Where are you having problems with?
With defining the class and it's data members (read this) ? or with writing a program to solve the problem described above (look at lerner's post) ?

its just like -_-
i sorta get the syntax of code sorta
but like it all seems like gibberish i dont know what to put where i see everyones response and i can read them and im sure they make sense but to me it might as ell be in a different language and this stuff is so frustrating i was crying in the middle of class and had to leave cause i dont get this stuff and thats just more stuff i missed and just less i know how to do and i was lost enough before and i just wanna drop out but i need to pass this stupid class for my major for some ridiculous reason and just ahhh i wanna scream

i dont know what a dynamic variable is, how to make one, why youd wanna, i dont get what classes are, set functions none of this stuff..ugh sorry to rant

its just like -_-
i sorta get the syntax of code sorta
but like it all seems like gibberish i dont know what to put where i see everyones response and i can read them and im sure they make sense but to me it might as ell be in a different language and this stuff is so frustrating i was crying in the middle of class and had to leave cause i dont get this stuff and thats just more stuff i missed and just less i know how to do and i was lost enough before and i just wanna drop out but i need to pass this stupid class for my major for some ridiculous reason and just ahhh i wanna scream

i dont know what a dynamic variable is, how to make one, why youd wanna, i dont get what classes are, set functions none of this stuff..ugh sorry to rant

In that case you should read a tutorial/book about C++ first ...

This article has been dead for over six months. Start a new discussion instead.