homework please help me

How will I add the existing content of the text file to the newly inputed date(hoursworked & minsWorked) to compute the total number of hours works please help me I'm just a beginner in using Visual basic C++. I dont know wht to do please help me guys.

I hope you can help me please this is in rush

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
 #include <stdio.h>
#include "conio.h"
#include <iostream>
#include <windows.h>
#include<string>
using namespace std;
HANDLE console = GetStdHandle(STD_OUTPUT_HANDLE);
COORD CursorPosition;
void gotoXY(int x, int y);
int choice;
float in,out,totalhours,inmin,outmin,totalmin,converter=60,temp1;
float in2,out2,totalhours2,inmin2,outmin2,totalmin2,converter2=60,temp2,daytotalhours,daytotalminutes; 
	void add()
	{
		
	gotoXY(30,1);cout<<"DAILY TIME RECORD";
	gotoXY(20,2);cout<<"MORNING"; gotoXY(50,2);cout<<"AFTERNOON"; 
	gotoXY(12,4);cout<<"Time-in"; gotoXY(28,4);cout<<"Time-out";
	gotoXY(42,4);cout<<"Time-in"; gotoXY(60,4);cout<<"Time-out";
	gotoXY(13,5);cin>>in; gotoXY(14,5);cout<<":"; gotoXY(15,5);cin>>inmin;
	gotoXY(29,5);cin>>out; gotoXY(31,5);cout<<":"; gotoXY(32,5);cin>>outmin;

		if(outmin<inmin)
	{
		temp1=inmin-outmin;
		converter-=temp1;
		totalhours=out-in;
		totalhours-=1;
     gotoXY(19,7);cout<<"Hours used";
	gotoXY(21,8);cout<<totalhours; gotoXY(22,8); cout<<":"; cout<<converter; 
	}
	else
	{
	totalhours=out-in;
	totalmin=outmin-inmin;

	if(totalmin>0&&totalmin<10)
	{
     gotoXY(19,7);cout<<"Hours used";
	gotoXY(22,8);cout<<totalhours;gotoXY(23,8); cout<<":";	gotoXY(24,8);cout<<"0"; ; cout<<totalmin; 
	}
	else
	{
		 gotoXY(19,7);cout<<"Hours used";
	gotoXY(22,8);cout<<totalhours; gotoXY(23,8); cout<<":"; cout<<totalmin; 
	}	
	}
	
	//afternoon
	gotoXY(43,5);cin>>in2; gotoXY(45,5);cout<<":"; gotoXY(46,5);cin>>inmin2;
	gotoXY(61,5);cin>>out2; gotoXY(63,5);cout<<":"; gotoXY(64,5);cin>>outmin2;

		if(outmin2<inmin2)
	{
		temp2=inmin2-outmin2;
		converter2-=temp2;
		totalhours2=out2-in2;
		totalhours2-=1;
     gotoXY(50,7);cout<<"Hours used";
	gotoXY(53,8);cout<<totalhours2; gotoXY(54,8); cout<<":"; cout<<converter2; 
	}
	else
	{
	totalhours2=out2-in2;
	totalmin2=outmin2-inmin2;
	
	if(totalmin2>0&&totalmin2<10)
	{
	gotoXY(50,7);cout<<"Hours used";
	gotoXY(53,8);cout<<totalhours2; gotoXY(54,8); cout<<":";	gotoXY(55,8);cout<<"0"; ; cout<<totalmin2; 
	}
	else
	{
	gotoXY(50,7);cout<<"Hours used";
	gotoXY(53,8);cout<<totalhours2; gotoXY(54,8); cout<<":"; cout<<totalmin2; 
	}	
	}
	daytotalhours=totalhours+totalhours2;
	daytotalminutes=totalmin+totalmin2;
	gotoXY(31,9);cout<<"Total Hours Used";
	gotoXY(37,10);cout<<daytotalhours<<":00";
	
	}
int main()
{
	gotoXY(33,2);cout<<"-----MENU-----";
	gotoXY(33,4);cout<<"(1) Add Record";
	gotoXY(33,5);cout<<"(2) View";
	gotoXY(33,6);cout<<"(3) Delete";
	gotoXY(33,7);cout<<"(4) Quit";
	gotoXY(33,8);cout<<"Choice:";cin>>choice;
	if(choice==1)
	{
		system("cls");
		add();
	}
	
	
	
return 0;
	
}

void gotoXY(int x, int y) 
{ 
CursorPosition.X = x; // Locates column
CursorPosition.Y = y; // Locates Row
SetConsoleCursorPosition(console,CursorPosition); // Sets position for next thing to be printed 
}
Topic archived. No new replies allowed.