小编gob*_*obo的帖子

提及"阶级"是不明确的

我想实现一个哈希表示例.所以为了这个目标,我创建了一个头文件,一个hash.cpp和main.cpp文件.在我的hash.cpp中,我试图运行一个虚拟哈希函数,该函数获取键值并转换为索引值.但是,每当我尝试根据该哈希类创建对象时,它会抛出一个错误(对'hash'的引用是不明确的).

这是我的main.cpp:

#include "hash.h"
#include <iostream>
#include <cstdlib>
#include <string>
#include <stdio.h>

using namespace std;

int main(int argc, const char * argv[]) {

    hash hash_object;
    int index;
    index=hash_object.hash("patrickkluivert");

    cout<<"index="<<index<<endl;
return 0;
}
Run Code Online (Sandbox Code Playgroud)

这是我的hash.cpp:

#include "hash.h"
#include <iostream>
#include <cstdlib>
#include <string>
#include <stdio.h>


using namespace std;

int hash(string key){
    int hash=0;
 int index;
    index=key.length();

    return index;
}
Run Code Online (Sandbox Code Playgroud)

这是我的hash.h

#include <stdio.h>
#include <iostream>
#include <cstdlib>
#include <string>

using namespace std;

#ifndef __hashtable__hash__
#define __hashtable__hash__
class hash
{
    public:
     int Hash(string key); …
Run Code Online (Sandbox Code Playgroud)

c++ hash std

1
推荐指数
1
解决办法
3474
查看次数

预检的响应具有无效的HTTP状态代码403

我正在使用服务器端Spring-boot并提供虚拟服务进行测试

我的ServiceCaller.java =

package com.user.server.mfw;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.handler.MappedInterceptor;


@RestController
public class ServiceCaller {
    @CrossOrigin(allowedHeaders="*",allowCredentials="true")
    @RequestMapping(value="/serviceCaller",method=RequestMethod.POST, headers="content-type=text/*")
    @ResponseBody
    String serviceListener(@RequestParam("serviceName") String serviceName,HttpSession session,HttpServletRequest theHttpServletReq ) throws IOException 
    {


        if(!serviceName.isEmpty())
        {
           byte[] encoded = Files.readAllBytes(Paths.get("C://Users//something//Desktop//asd.json"));
           return new String(encoded, "UTF-8");
        }
        return "gelemedi";
    }


    private void checkActiveSessionControl(HttpSession session)
    {   
        System.out.println("Session Id:" +  session.getId() …
Run Code Online (Sandbox Code Playgroud)

http angularjs spring-boot ionic-framework

1
推荐指数
1
解决办法
5982
查看次数

标签 统计

angularjs ×1

c++ ×1

hash ×1

http ×1

ionic-framework ×1

spring-boot ×1

std ×1