WoodShedd
01-17-2003, 01:12 AM
The other day I bought a hat in a thrift store. I washed it 3 times and its still stinky.
I also bought a relatively new looking college textbook on C++. I've always wanted to learn a new language, but i prefer speaking to things that can't not listen. That ruled out most languages spoken by humans.
anyway I read the first two chapters and decided to try my hand at a (simple) program.
I dont have a compiler so I dont know this runs or works. would any of you experienced programmers be able to tell by looking at it? just a note that i put in stdafx.h because the book mentioned it
// foil.cpp : The program will expand equations of the type (ax+b)(cx+d)
//
#include "stdafx.h"
#include <iostream>
using namespace std;
int main(int argc, char* argv[])
{
int first, inside, outside, last;
int term1, term2, term3;
cout << "(ax+b)(cx+d)" <<endl;
cout << "Please enter a, b, c and d, respectively. Press enter after you are done:";
cin >> first >> inside >> outside >> last;
term3 = inside * last;
term2 = (first * last) + (inside * outside);
term1 = first * outside;
cout << "(" << first << "x" << "+" << inside << ")" << "(" << outside << "x" << "+" << last << ")" <<endl;
cout << "the above expands to:" << endl;
cout << term1 << "x^2" <<"+" << term2 <<"x" <<"+" << term3 <<endl;
return 0;
}
thanks for any help
I also bought a relatively new looking college textbook on C++. I've always wanted to learn a new language, but i prefer speaking to things that can't not listen. That ruled out most languages spoken by humans.
anyway I read the first two chapters and decided to try my hand at a (simple) program.
I dont have a compiler so I dont know this runs or works. would any of you experienced programmers be able to tell by looking at it? just a note that i put in stdafx.h because the book mentioned it
// foil.cpp : The program will expand equations of the type (ax+b)(cx+d)
//
#include "stdafx.h"
#include <iostream>
using namespace std;
int main(int argc, char* argv[])
{
int first, inside, outside, last;
int term1, term2, term3;
cout << "(ax+b)(cx+d)" <<endl;
cout << "Please enter a, b, c and d, respectively. Press enter after you are done:";
cin >> first >> inside >> outside >> last;
term3 = inside * last;
term2 = (first * last) + (inside * outside);
term1 = first * outside;
cout << "(" << first << "x" << "+" << inside << ")" << "(" << outside << "x" << "+" << last << ")" <<endl;
cout << "the above expands to:" << endl;
cout << term1 << "x^2" <<"+" << term2 <<"x" <<"+" << term3 <<endl;
return 0;
}
thanks for any help
