/*in this part i'm giving sum data but i have error...please talk with me about my program */
#include<iostream.h>
#include<string.h>
#include<conio.h>
void point(int*,int*,int*);
void goal(int*,int*);
int name(char[40][40],int,int);
int Time(int[4][10],int,int);
int time(int[4][10],int,int);
void main()
{
int G1,g1,G2,g2,G3,g3,G4,g4,G5,g5;
int G1sum=0,G2sum=0,G3sum=0,G4sum=0,G5sum=0;
int g1sum=0,g2sum=0,g3sum=0,g4sum=0,g5sum=0;
int p1,p2,p3,p4,p5,P1=0,P2=0,P3=0,P4=0,P5=0;
int T1[4][10],T2[4][10],T3[4][10],T4[4][10],T5[4][10];
int t1[4][10],t2[4][10],t3[4][10],t4[4][10],t5[4][10];
int i=0,j=0,k=0,z=0,num=1;
char team[5][20],steam[20];
char n1[40][40],n2[40][40],n3[40][40],n4[40][40],n5[40][40];
for(i=0;i<5;i++){
cout<<"Enter name of "<<(i+1)<<"th team:";
cin>>team[i];
}
cout<<"\nNow enter details for each one...";
while(num<6){
cout<<"\nPlease enter name of one of them:" ;
cin>>steam;
if(strcmp(steam,team[0])==0){
for(i=1;i<5;i++){
cout<<"\nEnter reports for "<<team[0]<<" VS "<<team[i]<<" please...";
goal(&G1,&g1);
G1sum+=G1;
g1sum+=g1;
point(&G1,&g1,&p1);
P1+=p1;
j=name(n1,G1sum,j);
k=Time(T1,G1,k);
z=time(t1,g1,z);
}
j=k=z=0;
continue;
}//end of first if
else if(strcmp(steam,team[1])==0){
for(i=0;i<5;i++){
if(i==1)
i++;
cout<<"\nEnter reports for "<<team[1]<<" VS "<<team[i]<<" please...";
goal(&G2,&g2);
G2sum+=G2;
g2sum+=g2;
point(&G2,&g2,&p2);
P2+=p2;
j=name(n2,G2sum,j);
k=Time(T2,G2,k);
z=time(t2,g2,z);
}
j=k=z=0;
continue;
}//end of second if
else if(strcmp(steam,team[2])==0){
for(i=0;i<5;i++){
if(i==2)
i++;
cout<<"\nEnter reports for "<<team[2]<<" VS "<<team[i]<<" please...";
goal(&G3,&g3);
G3sum+=G3;
g3sum+=g3;
point(&G3,&g3,&p3);
P3+=p3;
j=name(n3,G3sum,j);
k=Time(T3,G3,k);
z=time(t3,g3,z);
}
j=k=z=0;
continue;
}//end of third if
else if(strcmp(steam,team[3])==0){
for(i=0;i<5;i++){
if(i==3)
i++;
cout<<"\nEnter reports for "<<team[3]<<" VS "<<team[i]<<" please...";
goal(&G4,&g4);
G4sum+=G4;
g4sum+=g4;
point(&G4,&g4,&p4);
P4+=p4;
j=name(n4,G4sum,j);
k=Time(T4,G4,k);
z=time(t4,g4,z) ;
}
j=k=z=0;
continue;
}//end of fourth if
else if(strcmp(steam,team[4])==0){
for(i=0;i<4;i++){
cout<<"\nEnter reports for "<<team[4]<<" VS "<<team[i]<<" please...";
goal(&G5,&g5);
G5sum+=G5;
g5sum+=g5;
point(&G5,&g5,&p5);
P5+=p5;
j=name(n5,G5sum,j);
k=Time(T5,G5,k);
z=time(t5,g5,z);
}
j=k=z=0;
continue;
}
else
cout<<"\nYou entered unknown team!Try again...";
num++;
}
}
void goal(int*p1,int*p2)
{
cout<<"\ngolhaye zade:";
cin>>*p1;
cout<<"golhaye khorde:";
cin>>*p2;
}
void point(int*p1,int*p2,int*p3)
{
if(*p1>*p2)
*p3=3;
else
*p3=1;
}
int name(char n[40][40],int sum,int j)
{
for(j;j<sum;j++){
cout<<"\nwho goals?(After a name press ENTER):";
cin.get();
cin.get(n[j],40);
}
return j;
}
int Time(int T[4][10],int G,int k)
{
int j;
for(j=0;j<G;j++){
cout<<"\nEnter time of "<<(j+1)<<"th goal(by minute) which the team shooted:";
cin>>T[k][j];
}
return k;
}
int time(int t[4][10],int g,int z)
{
int j;
for(j=0;j<g;j++){
cout<<"\nEnter time of "<<(j+1)<<"th goal(by minute) which the team received:";
cin>>t[z][j];
}
return z;
}
3 1240
hi
y du u want to assign some data before #include?
just do it afterwards and c
Thnx
Xoinki
No error in your program. Its runs safely. What compiler u r using. I copy your code and run in VC++ compiler.
What error u get
regards,
karthickbabu
/*in this part i'm giving sum data but i have error...please talk with me about my program */
#include<iostream.h>
#include<string.h>
#include<conio.h>
void point(int*,int*,int*);
void goal(int*,int*);
int name(char[40][40],int,int);
int Time(int[4][10],int,int);
int time(int[4][10],int,int);
void main()
{
int G1,g1,G2,g2,G3,g3,G4,g4,G5,g5;
int G1sum=0,G2sum=0,G3sum=0,G4sum=0,G5sum=0;
int g1sum=0,g2sum=0,g3sum=0,g4sum=0,g5sum=0;
int p1,p2,p3,p4,p5,P1=0,P2=0,P3=0,P4=0,P5=0;
int T1[4][10],T2[4][10],T3[4][10],T4[4][10],T5[4][10];
int t1[4][10],t2[4][10],t3[4][10],t4[4][10],t5[4][10];
int i=0,j=0,k=0,z=0,num=1;
char team[5][20],steam[20];
char n1[40][40],n2[40][40],n3[40][40],n4[40][40],n5[40][40];
for(i=0;i<5;i++){
cout<<"Enter name of "<<(i+1)<<"th team:";
cin>>team[i];
}
cout<<"\nNow enter details for each one...";
while(num<6){
cout<<"\nPlease enter name of one of them:" ;
cin>>steam;
if(strcmp(steam,team[0])==0){
for(i=1;i<5;i++){
cout<<"\nEnter reports for "<<team[0]<<" VS "<<team[i]<<" please...";
goal(&G1,&g1);
G1sum+=G1;
g1sum+=g1;
point(&G1,&g1,&p1);
P1+=p1;
j=name(n1,G1sum,j);
k=Time(T1,G1,k);
z=time(t1,g1,z);
}
j=k=z=0;
continue;
}//end of first if
else if(strcmp(steam,team[1])==0){
for(i=0;i<5;i++){
if(i==1)
i++;
cout<<"\nEnter reports for "<<team[1]<<" VS "<<team[i]<<" please...";
goal(&G2,&g2);
G2sum+=G2;
g2sum+=g2;
point(&G2,&g2,&p2);
P2+=p2;
j=name(n2,G2sum,j);
k=Time(T2,G2,k);
z=time(t2,g2,z);
}
j=k=z=0;
continue;
}//end of second if
else if(strcmp(steam,team[2])==0){
for(i=0;i<5;i++){
if(i==2)
i++;
cout<<"\nEnter reports for "<<team[2]<<" VS "<<team[i]<<" please...";
goal(&G3,&g3);
G3sum+=G3;
g3sum+=g3;
point(&G3,&g3,&p3);
P3+=p3;
j=name(n3,G3sum,j);
k=Time(T3,G3,k);
z=time(t3,g3,z);
}
j=k=z=0;
continue;
}//end of third if
else if(strcmp(steam,team[3])==0){
for(i=0;i<5;i++){
if(i==3)
i++;
cout<<"\nEnter reports for "<<team[3]<<" VS "<<team[i]<<" please...";
goal(&G4,&g4);
G4sum+=G4;
g4sum+=g4;
point(&G4,&g4,&p4);
P4+=p4;
j=name(n4,G4sum,j);
k=Time(T4,G4,k);
z=time(t4,g4,z) ;
}
j=k=z=0;
continue;
}//end of fourth if
else if(strcmp(steam,team[4])==0){
for(i=0;i<4;i++){
cout<<"\nEnter reports for "<<team[4]<<" VS "<<team[i]<<" please...";
goal(&G5,&g5);
G5sum+=G5;
g5sum+=g5;
point(&G5,&g5,&p5);
P5+=p5;
j=name(n5,G5sum,j);
k=Time(T5,G5,k);
z=time(t5,g5,z);
}
j=k=z=0;
continue;
}
else
cout<<"\nYou entered unknown team!Try again...";
num++;
}
}
void goal(int*p1,int*p2)
{
cout<<"\ngolhaye zade:";
cin>>*p1;
cout<<"golhaye khorde:";
cin>>*p2;
}
void point(int*p1,int*p2,int*p3)
{
if(*p1>*p2)
*p3=3;
else
*p3=1;
}
int name(char n[40][40],int sum,int j)
{
for(j;j<sum;j++){
cout<<"\nwho goals?(After a name press ENTER):";
cin.get();
cin.get(n[j],40);
}
return j;
}
int Time(int T[4][10],int G,int k)
{
int j;
for(j=0;j<G;j++){
cout<<"\nEnter time of "<<(j+1)<<"th goal(by minute) which the team shooted:";
cin>>T[k][j];
}
return k;
}
int time(int t[4][10],int g,int z)
{
int j;
for(j=0;j<g;j++){
cout<<"\nEnter time of "<<(j+1)<<"th goal(by minute) which the team received:";
cin>>t[z][j];
}
return z;
}
/*in this part i'm giving sum data but i have error...please talk with me about my program */
#include<iostream.h>
#include<string.h>
#include<conio.h>
void point(int*,int*,int*);
void goal(int*,int*);
int name(char[40][40],int,int);
int Time(int[4][10],int,int);
int time(int[4][10],int,int);
void main()
{
int G1,g1,G2,g2,G3,g3,G4,g4,G5,g5;
int G1sum=0,G2sum=0,G3sum=0,G4sum=0,G5sum=0;
int g1sum=0,g2sum=0,g3sum=0,g4sum=0,g5sum=0;
int p1,p2,p3,p4,p5,P1=0,P2=0,P3=0,P4=0,P5=0;
int T1[4][10],T2[4][10],T3[4][10],T4[4][10],T5[4][10];
int t1[4][10],t2[4][10],t3[4][10],t4[4][10],t5[4][10];
int i=0,j=0,k=0,z=0,num=1;
char team[5][20],steam[20];
char n1[40][40],n2[40][40],n3[40][40],n4[40][40],n5[40][40];
for(i=0;i<5;i++){
cout<<"Enter name of "<<(i+1)<<"th team:";
cin>>team[i];
}
cout<<"\nNow enter details for each one...";
while(num<6){
cout<<"\nPlease enter name of one of them:" ;
cin>>steam;
if(strcmp(steam,team[0])==0){
for(i=1;i<5;i++){
cout<<"\nEnter reports for "<<team[0]<<" VS "<<team[i]<<" please...";
goal(&G1,&g1);
G1sum+=G1;
g1sum+=g1;
point(&G1,&g1,&p1);
P1+=p1;
j=name(n1,G1sum,j);
k=Time(T1,G1,k);
z=time(t1,g1,z);
}
j=k=z=0;
continue;
}//end of first if
else if(strcmp(steam,team[1])==0){
for(i=0;i<5;i++){
if(i==1)
i++;
cout<<"\nEnter reports for "<<team[1]<<" VS "<<team[i]<<" please...";
goal(&G2,&g2);
G2sum+=G2;
g2sum+=g2;
point(&G2,&g2,&p2);
P2+=p2;
j=name(n2,G2sum,j);
k=Time(T2,G2,k);
z=time(t2,g2,z);
}
j=k=z=0;
continue;
}//end of second if
else if(strcmp(steam,team[2])==0){
for(i=0;i<5;i++){
if(i==2)
i++;
cout<<"\nEnter reports for "<<team[2]<<" VS "<<team[i]<<" please...";
goal(&G3,&g3);
G3sum+=G3;
g3sum+=g3;
point(&G3,&g3,&p3);
P3+=p3;
j=name(n3,G3sum,j);
k=Time(T3,G3,k);
z=time(t3,g3,z);
}
j=k=z=0;
continue;
}//end of third if
else if(strcmp(steam,team[3])==0){
for(i=0;i<5;i++){
if(i==3)
i++;
cout<<"\nEnter reports for "<<team[3]<<" VS "<<team[i]<<" please...";
goal(&G4,&g4);
G4sum+=G4;
g4sum+=g4;
point(&G4,&g4,&p4);
P4+=p4;
j=name(n4,G4sum,j);
k=Time(T4,G4,k);
z=time(t4,g4,z) ;
}
j=k=z=0;
continue;
}//end of fourth if
else if(strcmp(steam,team[4])==0){
for(i=0;i<4;i++){
cout<<"\nEnter reports for "<<team[4]<<" VS "<<team[i]<<" please...";
goal(&G5,&g5);
G5sum+=G5;
g5sum+=g5;
point(&G5,&g5,&p5);
P5+=p5;
j=name(n5,G5sum,j);
k=Time(T5,G5,k);
z=time(t5,g5,z);
}
j=k=z=0;
continue;
}
else
cout<<"\nYou entered unknown team!Try again...";
num++;
}
}
void goal(int*p1,int*p2)
{
cout<<"\ngolhaye zade:";
cin>>*p1;
cout<<"golhaye khorde:";
cin>>*p2;
}
void point(int*p1,int*p2,int*p3)
{
if(*p1>*p2)
*p3=3;
else
*p3=1;
}
int name(char n[40][40],int sum,int j)
{
for(j;j<sum;j++){
cout<<"\nwho goals?(After a name press ENTER):";
cin.get();
cin.get(n[j],40);
}
return j;
}
int Time(int T[4][10],int G,int k)
{
int j;
for(j=0;j<G;j++){
cout<<"\nEnter time of "<<(j+1)<<"th goal(by minute) which the team shooted:";
cin>>T[k][j];
}
return k;
}
int time(int t[4][10],int g,int z)
{
int j;
for(j=0;j<g;j++){
cout<<"\nEnter time of "<<(j+1)<<"th goal(by minute) which the team received:";
cin>>t[z][j];
}
return z;
}
Hi Memol,
Gone through your code. The code seems working fine and does not has any issues. But can you just amend a few things so that the things become easier for you and everyone reading your code.
1.> Why have you taken so many global variables in the program? Although you have used very little.
2.> Can you please rename the variables and use the give them the appropriate names so that the variables look more programatic and traced down well?
3.> Can you please trace the program by using comments at appropriate places?
Hope this all improves your programming skills and you write excellent programs.... :-) :-)
Kudos and Cheers,
Sign in to post your reply or Sign up for a free account.
Similar topics
by: yy0127 |
last post by:
I don't know why i entered the below code and it will miss some
records.
Anyone can help me???
users = {}
users1 = {}
while 1:
user, serviceType, msgType, inOut, date, time, numBytes =
|
by: Az Tech |
last post by:
Hi people,
(Sorry for the somewhat long post).
I request some of the people on this group who have good experience
using object-orientation in the field, to please give some good ideas
for...
|
by: TrvlOrm |
last post by:
HI There,
I have been struggling with JavaScript code for days now, and this is
my last resort! Please help...
I am trying to create a JavaScript slide show with links for Next
Slide,...
|
by: x muzuo |
last post by:
Hi guys,
I have got a prob of javascript form validation which just doesnt work
with my ASP code. Can any one help me out please.
Here is the code:
{////<<head>
<title>IIBO Submit Page</title>...
|
by: Joner |
last post by:
Hello,
I'm having trouble with a little programme of mine where I connect to
an access database. It seems to connect fine, and disconnect fine, but
then after it won't reconnect, I get the error...
|
by: David Van D |
last post by:
Hi there,
A few weeks until I begin my journey towards a degree in Computer
Science at Canterbury University in New Zealand,
Anyway the course tutors are going to be teaching us JAVA wth bluej...
|
by: Olly |
last post by:
Hello Everyone!
Could someone please have a look at my JS Form I posted
below....Something wrong there, but I don't understand what's exactly.
Many thanks.
Olly
...
|
by: ndawg123 |
last post by:
Hey guys what im trying to do is write a yatzee game with C.
And im stuck already and its the start?!?!
I want the user to type there 5 numbers.
i.e My program so far does this
Please...
|
by: tabani |
last post by:
I wrote the program and its not giving me correct answer can any one help me with that please and specify my mistake please it will be highly appreciable...
The error arrives from option 'a' it asks...
|
by: simonyong |
last post by:
I'm newbie to .net and currently learning to use BLOB to insert image into database
What i'm facing is i dont know what is going wrong to make me continue getting this error:
An unhandled...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |