Ok, ive literally started learning to use C++ today and have bought Herbert Schildts "C++ A Beginners Guide". The book so far is extremely good so far for someone who knows nothing of C++ like me.
As I am away from home I am using the CodeToGo ipad app to do all the examples. I've got to one example which I'm not sure what end result I'm suppose to get. I'm not sure if the CodeToGo app is limited to what it can output but I coded an iteractive program that computes the area of a rectangle and after running it I get an odd result. I assumed the program would allow me to enter values and gain a result but instead its just text with a random result each time.
here's the code.
/* An interactive program that computes
the are of a retangle.
*/
#include <iostream>
usingnamespace std;
int main()
{
int length;
int width;
cout << "Enter the length: ";
cin >> length; // input the length
cout << "Enter the width: ";
cin >> width; // input the width
cout << "The area is ";
cout << length * width; // display the area
return 0;
}
Am I doing something wrong or not understanding or is it just the limitations of the iPad app.
Many thanks for any help.
CodeToGo passes your code to a website, which compiles and runs it, and passes back the output.
Since you have to have a connection to run it, you might find it easier to just use http://ideone.com which has a box into which you can enter the input, before running it.
using Microsofts Visual C++, would it output as a program to enter the values? I couldnt find the button you referred to on ideone.com. as long as I know its just the apps limitations and not that I'm doing anything wrong, I'll be happy.
As I said, I'm away from home. I just wanted to make sure I was doing things right before progressing. All the other examples worked fine. I plan on using Microsofts Visual C++ once I'm back home.