'setioflags' undeclared identifier?

This is a discussion on 'setioflags' undeclared identifier? within the C++ Programming forums, part of the General Programming Boards category; these setioflags and things are a little confusing to me. i tried ot write a progrm so i'd understand but ...

  1. #1
    Registered User
    Join Date
    Sep 2003
    Posts
    45

    'setioflags' undeclared identifier?

    these setioflags and things are a little confusing to me. i tried ot write a progrm so i'd understand but it says its an undeclared identifier? and it says that setw is not a member of 'ostream_withassign'. heres my code


    Code:
    #include<iostream.h>
    #include<iomanip.h>
    
    void main()
    {
    	int x;
    	int stockNum[2];
    	int quantity[2];
    	double Price[2];
    
    	for(x=1;x<2;++x)
    	{
    		cout<<"Enter Stock Number: ";
    		cin>>stockNum[x];
    		cout<<"Quantity: ";
    		cin>>quantity[x];
    		cout<<"Price: ";
    		cin>>Price[x];
    	}
    
    	cout<<"You Entered: "<<endl<<endl;
    
    	cout<<setioflags(ios::left)<<"Stock Number"<<setioflags(ios::right)<<setw(25)<<"Quantity"<<setw(40)<<setioflags(ios::right)<<"Price"<<endl;
    	for(x=1;x<2;++x)
    		cout<<setioflags(ios::left)<<stockNum[x]<<setioflags(ios::right)<<setw(25)<<quantity[x]<<cout.setw(40)<<setioflags(ios::right)<<Price[x]<<endl;
    }

  2. #2
    Me -=SoKrA=-'s Avatar
    Join Date
    Oct 2002
    Location
    Europe
    Posts
    448
    Try using the new headers, ie. <iostream> and <iomanip> and add a using namespace std; line below the #includes. That may solve some problems.
    SoKrA-BTS "Judge not the program I made, but the one I've yet to code"
    I say what I say, I mean what I mean.
    IDE: emacs + make + gcc and proud of it.

  3. #3
    Registered User
    Join Date
    Sep 2003
    Posts
    45
    still didnt work

  4. #4
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,789
    setioflags != setiosflags

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. An error is driving me nuts!
    By ulillillia in forum C Programming
    Replies: 5
    Last Post: 04-04-2009, 10:15 PM
  2. Game Pointer Trouble?
    By Drahcir in forum C Programming
    Replies: 8
    Last Post: 02-04-2006, 02:53 AM
  3. Why wont my function exit correctly?
    By LightsOut06 in forum C Programming
    Replies: 2
    Last Post: 10-09-2005, 10:23 PM
  4. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 07:39 AM
  5. Problem with Visual C++ Object-Oriented Programming Book.
    By GameGenie in forum C++ Programming
    Replies: 9
    Last Post: 08-30-2005, 12:21 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21