Hi I need some help with error C4430

I have to write a program that do Caesars Cipher.
I have 3 file: main header and implementation file.
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
// JangJHW3.cpp : main project file.===========================================
#include "stdafx.h"
#include <string>
#include <iostream>
#include "CaesarsCipher.h"
#include <fstream>

using namespace std;
using namespace System;

int SetUp(string&, int&);
void end(string input, string output, int num);
	
int main(){
	int num = 0, she = 0;
	string input, output;

	num = SetUp(input, she);
	CaesarsCipher CC(she);

	if (num == 1){

		output = CC.encode(input);
		end(input, output, num);
	}
	if (num == 2) {

		output = CC.decode(input);
		end(input, output, num);
	}

}

int SetUp(string& input, int& num){...} 
// this will give backshift number, choice number, and a string 

void end(string input, string output, int num){...}
// this will print out code or sentence in english and save in txt file. 




1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// "CaesarsCipher.h" :this is header file======================================
#include "stdafx.h"
#include <string>
#include <iostream>
using namespace std;
using namespace System;

class CaesarsCipher {

public:
	CaesarsCipher();
	CeasarsCipher(int num); // over 
	string encode(string input);
	string decode(string input);

private:
	int shift;

};




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
//"CaesarsCipher.cpp" this is the class file===================================
#include "stdafx.h"
#include <string>
#include <iostream>
#include "CaesarsCipher.h"
#include <cstring>

using namespace std;
using namespace System;

CaesarsCipher::CaesarsCipher(){
	//defalt constructor 
	shift=0;
}
CaesarsCipher::CaesarsCipher(int num){
	//overloaded constructor some value for shift
	shift = num;
}

string CaesarsCipher::encode(string english){
	
	char* Cinput = NULL;
	int length = english.length();
	Cinput = new char[101];
	string output = "";
	int i = 0;
	for (i = 0; i <length; i++){

		Cinput[i] = english.at(i);

	}

	Cinput [length] = '\0';
	
	i = 0;
	while(Cinput[i] != '#'){
		if ( (Cinput[i] >= 'a' && Cinput[i] <= 'z') ){
			
			Cinput[i] = 'a' + ( Cinput[i] - 'a' + shift ) % 26;

		}
		if ( (Cinput[i] >= 'A' && Cinput[i] <='Z') ){

			Cinput[i] = 'A' + ( Cinput[i] - 'A' + shift ) % 26;

		}
		i++;
	}

	i = 0;
	while(Cinput[i] != '#'){

		output = output + Cinput[i];

		i++;
	}

	delete [] Cinput;

	return output;
}

string CaesarsCipher::decode(string code){
	
	char* Cinput = NULL;
	int length = code.length();
	Cinput = new char[101];
	string english = "";

	int i = 0;
	for (i = 0; i <length; i++){

		Cinput[i] = code.at(i);

	}

	Cinput [length] = '\0';
	
	i = 0;
	while(Cinput[i] != '#'){
		if ( (Cinput[i] >= 'a' && Cinput[i] <= 'z') ){
			
			Cinput[i] = 'a' + (   Cinput[i] - 'a'  - shift ) % 26;

		}
		if ( (Cinput[i] >= 'A' && Cinput[i] <='Z') ){

			Cinput[i] = 'A' + (  Cinput[i] - 'A'  - shift ) % 26;

		}
		i++;
	}

	i = 0;
	while(Cinput[i] != '#'){

		english = english + Cinput[i];

		i++;
	}

	delete [] Cinput;

	return english;
}


===================================Output=======================================

1>------ Build started: Project: JangJHW3, Configuration: Debug Win32 ------
1>Build started 2/15/2013 7:28:12 PM.
1>InitializeBuildStatus:
1>  Touching "Debug\JangJHW3.unsuccessfulbuild".
1>GenerateTargetFrameworkMonikerAttribute:
1>Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output files are up-to-date with respect to the input files.
1>ClCompile:
1>  All outputs are up-to-date.
1>  CaesarsCipher.cpp
1>u:\fundamentals of software engineering\jangjhw3\jangjhw3\CaesarsCipher.h(12): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>u:\fundamentals of software engineering\jangjhw3\jangjhw3\CaesarsCipher.h(12): warning C4183: 'CeasarsCipher': missing return type; assumed to be a member function returning 'int'
1>CaesarsCipher.cpp(15): error C2511: 'CaesarsCipher::CaesarsCipher(int)' : overloaded member function not found in 'CaesarsCipher'
1>          u:\fundamentals of software engineering\jangjhw3\jangjhw3\CaesarsCipher.h(8) : see declaration of 'CaesarsCipher'
1>  JangJHW3.cpp
1>u:\fundamentals of software engineering\jangjhw3\jangjhw3\CaesarsCipher.h(12): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>u:\fundamentals of software engineering\jangjhw3\jangjhw3\CaesarsCipher.h(12): warning C4183: 'CeasarsCipher': missing return type; assumed to be a member function returning 'int'
1>JangJHW3.cpp(36): error C2664: 'CaesarsCipher::CaesarsCipher(const CaesarsCipher &)' : cannot convert parameter 1 from 'int' to 'const CaesarsCipher &'
1>          Reason: cannot convert from 'int' to 'const CaesarsCipher'
1>          No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
1>JangJHW3.cpp(147): warning C4018: '<' : signed/unsigned mismatch
1>  Generating Code...
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:01.16
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========



I was able to fix most of little foolish mistake, but error C4430, error C2511, error C2664 could not find the problem.

Can you please expain and help me???

if you need to reqire to see my two fuctions in the main file, I will post it
Last edited on
Topic archived. No new replies allowed.