Problem with...(well basically everything)

Hello
I was writing a simple program,just to train
so i've got a problem,here is code:
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
#include<iostream>
#include<fstream>
#include<string>


using namespace std;


void checktext();
void registtext();
void main1();
void wrong();
void cor();

int ch;
int un;
int up;
int txtchk;
int txht2chk;



void registtext(){
	system("CLS");
	ofstream file("myfyle.txt");
	cout<<"Choose text to type:\n";
	cin>>un;
	cout<<"Choose another text to type:\n";
	cin>>up;
	file<<un<<"\n"<<up<<"\n\n";
	main1();
	
}

int main(){
	main1();
}

void main1(){
	system("CLS");
	cout<<"Simple training program\n";
	cout<<"_______________________\n";
	cout<<"Choose option\n";
	cout<<"1.Write text\n";
	cout<<"2.Check for text existness\n";
	
	cin>>ch;
	
	if(ch == 1){
		checktext();
	}else if(ch == 2){
		registtext();
	}
}

void login(){
	system("CLS");
	ifstream DB("DataBase.ncdbf");
	cout<<"Type in text to check:\n";
	cin>>txtchk;
	cout<<"Type in another text to check \n";
	cin>>txt2chk;
	if(txtchk != un){
		cout<<"This text doesn't exist";
	}else if(txtchk == un){
		chat();
	}
	

	if(txt2chk != up){
		wrong();
	}else if(txt2chk == up){
		cor();
	}
}

void wrong(){
	cout<<"This text isn't in DataBase";
	system("pause");
	main1();
}

void cor(){
	cout<<"This text is in Database"
    system("pause");
	main1();
}

I run program,and choose to save text,then i type 1st text and then program starts blinking,changing screen with Save text screen and main text screen,also the 1st text isn't saved.
Firstly, this doesn't compile for me. You're using a variable called txt2chk (on line 62 for example), but you haven't declared a variable called that.
You also call a method called chat(), but I can't see that declared or defined anywhere?
You've also missed a semi-colon at the end of line 84.
Also you declare void checktext();, and try to call it on line 50 but provide no implementation for it.

Have a fix of those first.

edit: what compiler/IDE are you using?
Last edited on
Firstly, this doesn't compile for me. You're using a variable called txt2chk (on line 62 for example), but you haven't declared a variable called that.
You also call a method called chat(), but I can't see that declared or defined anywhere?
You've also missed a semi-colon at the end of line 84.
Also you declare void checktext();, and try to call it on line 50 but provide no implementation for it.

Have a fix of those first.

edit: what compiler/IDE are you using?

I use Dev C++
also i fixed all mistakes,but it still blinks and changes between main and registtext screens
Last edited on
Topic archived. No new replies allowed.