code .pdf

File information


Original filename: code.pdf

This PDF 1.4 document has been generated by VeryPDF Free Text To PDF Converter v1.5 / VeryPDF.com Inc (http://www.verypdf.com), and has been sent on pdf-archive.com on 10/06/2016 at 19:03, from IP address 182.68.x.x. The current document download page has been viewed 325 times.
File size: 2 KB (2 pages).
Privacy: public file


Download original PDF file


code.pdf (PDF, 2 KB)


Share on social networks



Link to this file download page



Document preview


/*
ID: ******
PROG: gift1
LANG: C++
*/
#include <iostream>
#include <fstream>
#include <string.h>
using namespace std;
int main() {
ofstream fout ("gift1.out");
ifstream fin ("gift1.in");
int n,j,account[10],z,y;
for(int i=0;i<10;i++)
account[i]=0;
fin>>n;
char name[10][10];
for(int i=0;i<n;i++)
{
fin>>name[i];
}
int people[10],money[10];
char temp[10];
for(int i=0;i<n;i++)
{fin>>temp;
for(j=0;j<n;j++)
{
if(strcmp(name[j],temp)==0)
{
fin>>money[j]>>people[j];
break;
}
}
account[j]-=money[j];
if(people[j]==0)
{
z=0;
y=money[j];
}

else
{
y=money[j]%people[j];
z=(money[j]-y)/people[j]; }
account[j]+=y;
for(int k=0;k<people[j];k++)
{
fin>>temp;
for(int g=0;g<n;g++)
{
if(strcmp(name[g],temp)==0)
{
account[g]+=z;
break;
}
}
}
}
for(int i=0;i<n;i++)
{
fout<<name[i]<<" "<<account[i]<<endl;
}
return 0;
}


Document preview code.pdf - page 1/2

Document preview code.pdf - page 2/2

Related documents


code
datastructuresnotes
untitled pdf document
introduction2programming theory
c cheat
arma 3 sqf cheat sheet revision 3

Link to this page


Permanent link

Use the permanent link to the download page to share your document on Facebook, Twitter, LinkedIn, or directly with a contact by e-Mail, Messenger, Whatsapp, Line..

Short link

Use the short link to share your document on Twitter or by text message (SMS)

HTML Code

Copy the following HTML code to share your document on a Website or Blog

QR Code

QR Code link to PDF file code.pdf