All pastes #398109 Raw Edit

Stuff

public cpp v1 · immutable
·published 2007-03-16 23:14 UTC
rendered paste body
#include <iostream>#include <fstream>#include <string>using namespace std;float numberofshares;float price;float totalprice(float numberofshares, float price);int main(){    char date[255];    char symbol[255];    char buysell[255];    char filelines[255];    string stringy;    //open the file    ofstream stocks( "stocks.txt" );    cout << "Enter the date of the transaction: ";    cin.getline(date, 255);    //cin.get();    cout << "Enter the symbol: ";    cin.getline(symbol, 255);    //cin.get();    cout << "What you did(buy, sell, etc): ";    cin.getline(buysell, 255);    //cin.get();    cout << "Number of shares you bought: ";    cin >> numberofshares;    //cin.get();    cout << "Price of the stock you bought: ";    cin >> price;    //cin.get();    stocks << date << " " << symbol << " " << buysell << " " << numberofshares << " " << price << " " << totalprice(numberofshares , price ) <<"\n" << endl;    stocks.close();    //open file to read    ifstream stock( "stocks.txt" );    while(!stock.eof())    {          stock >> stringy;          cout << stringy << endl;    }    cin.get();    cin.get();        return 0;} float totalprice(float numberofshares, float price){      return numberofshares * price;}