Jump to content

output code

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
10 replies to this topic

#1
kenex

kenex

    Learning Programmer

  • Members
  • PipPipPip
  • 32 posts
output code

--------------------------------------------------------------------------------

#include <iostream.h>

main()

{

int price,added_stock,qty_of_stock,current_stock,qty_sold,amount_sold,balanced_stock,item,item1,item2,item3,item4,item5;

cout<<"enter the item name\t";

cin>>item;

cout<<"price\t";

cin>>price;

cout<<"added stock\t";

cin>>added_stock;

cout<<"qty sold\t";

cin>>qty_sold;

cout<<"balanced_stock\t"

cin>>balanced_stock;



qty_of_stock=added_stock+balanced_stock;

amount_sold=qty_sold*price

current_stock=qty_of_stock-qty_sold

please what kind of output code can i use to display the output in the following order; each time there is a new item input.
OUTPUT FORMAT:
ITEM1.....
ADDED STOCK IS.......
QTY OF STOCK IS.......
CURRENT STOCK IS.......
QTY SOLD IS......
PRICE IS.......
AMOUNT SOLD IS.......
THANX

Edited by kenex, 28 January 2009 - 04:44 AM.
add code tags (the # button)


#2
Phoenixz

Phoenixz

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 256 posts
If you are wanting the original integer to be changed, you must use pointers, that code is also very very messy and hard to read. >_<
Posted Image

#3
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
You can't declare item three times, nor initialize it to variables that don't exist yet (item1, item2, item3).

I think what you're looking for is:
cout << "this is static text" << var1 << "\n";

Also, please use code tags (the # button)
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#4
kenex

kenex

    Learning Programmer

  • Members
  • PipPipPip
  • 32 posts
please what kind of statements is suitable 4 d program in order to give the output.since u already know what i'm looking 4.thanx

#5
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
I just gave you an example. Are you looking for me to finish your assignment for you?
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#6
kenex

kenex

    Learning Programmer

  • Members
  • PipPipPip
  • 32 posts
ok,now i understand.thanx

Assuming the above programme gave an output of different item data in different windows,how can i combine the outputs under one window,which of the code?.thanx

i mean combining C++ Source Code Files into one Document without Tabs

Edited by WingedPanther, 28 January 2009 - 08:20 AM.
triple post


#7
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
The above code only exists in one file, and produces output in one window, so I'm not clear on what you're asking... perhaps if you posted more of your code it would help.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#8
kenex

kenex

    Learning Programmer

  • Members
  • PipPipPip
  • 32 posts
The above code have a varriable inputs e.g item name,price,added stock,balanced stock,quantity sold.So each time thare is an input of a particular item data,it ouput in one window.so surppose there are different input item data and would not like it to be on a separate window,how do i combine it to be on one window without pressing tabs each time there is an input of a particular item data?

#9
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
You haven't posted any code that suggests there is anything other than a command line interface. Based on that, I can't really answer your question.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#10
kenex

kenex

    Learning Programmer

  • Members
  • PipPipPip
  • 32 posts
ok,i just have 2 copy and past the number of items i want 2 display on the source file and then run it.

#11
ethanjames

ethanjames

    Newbie

  • Members
  • Pip
  • 2 posts
sorry, i don't have any ideas about that.