can anybody tell me how these work. my book is kinda confusing..and when i do what i think will work ,it just comes out whever it wants to. this is what i have and it doesn't line up like i want it to...in 3 columns.
Code:#include<iostream.h> #include<iomanip.h> int main() { int x; int y; int stockNum[2]; int quantity[2]; double Price[2]; for(x=1;x<3;++x) { cout<<"Enter Stock Number: "; cin>>stockNum[x]; cout<<"Quantity: "; cin>>quantity[x]; cout<<"Price: "; cin>>Price[x]; } cout<<"You Entered: "<<endl<<endl; cout<<setiosflags(ios::left)<<"Stock Number"; cout<<setiosflags(ios::right)<<setw(35)<<"Quantity" cout<<setw(40)<<setiosflags(ios::right)<<"Price"<<endl; for(y=1;y<3;++y) cout<<resetiosflags(ios::left)<<stockNum[y]<<setiosflags(ios::right)<<setw(25)<<quantity[y]<<setprecision(2)<<setiosflags(ios::fixed | ios::showpoint | ios::right)<<Price[y]<<endl; }