#include<iostream>
#include<cstring>
using namespace std;
char * AllocateMemory(char *, char *);
char * createMesaage(char *s, char *str,char *msg){
strcpy(s, str);
strcat(s, msg);
return s;
}
char* client1(char* msg){
char str[] = "client1: ";
char *s = AllocateMemory(str, msg);
char *s1 = createMesaage(s,str,msg);
return s1;
}
char* client2(char* msg){
char str[] = "client2: ";
char *s = AllocateMemory(str, msg);
char *s1 = createMesaage(s,str,msg);
return s1;
}
char* client3(char* msg){
char str[] = "client3: ";
char *s = AllocateMemory(str, msg);
char *s1 = createMesaage(s,str,msg);
return s1;
}
typedef _________________; // LINE-1
char * AllocateMemory(char *str, char *msg){
char* s = new ______________________; // LINE-2
return s;
}
int main(){
int i;
char msg[80];
fun_ptr fp[3] = _______________________; //LINE-3
cin >> i >> msg;
const char * caller(fun_ptr *, int, char*);
const char *s = caller(fp, i, msg);
cout << s;
return 0;
}
const char* caller(fun_ptr *fp, int i, char* msg){
if(i >= 0 && i < 3)
fp[i](msg);
else{
const char *s = "unknown client";
return s;
}
}
We need at least 10 more requests to produce the answer.
0 / 10 have requested this problem solution
The more requests, the faster the answer.
fill in the blank to get ; client1: PPD, client2: Arup, unknown client
Today assignment , find the errors in this code and fixed them. Please I need help with find the errors and how ro fixed them. #include <iostream> #include <cstring> #include <iomanip> using namespace std; const int MAX_CHAR = 100; const int MIN_A = 90; const int MIN_B = 80; const int MIN_C = 70; double getAvg(); char determineGrade(double); void printMsg(char grade); int main() { double score; char grade; char msg[MAX_CHAR]; strcpy(msg, "Excellent!"); strcpy(msg, "Good job!"); strcpy(msg, "You've passed!"); strcpy(msg, "Need...
In C++ please!
*Do not use any other library functions(like strlen) than the
one posted(<cstddef>) in the code below!*
/**
CS 150 C-Strings
Follow the instructions on your handout to complete the
requested function. You may not use ANY library functions
or include any headers, except for <cstddef> for
size_t.
*/
#include <cstddef> // size_t for sizes and indexes
///////////////// WRITE YOUR FUNCTION BELOW THIS LINE
///////////////////////
///////////////// WRITE YOUR FUNCTION ABOVE THIS LINE
///////////////////////
// These are OK after...
include<iostream> #include<cstring> using namespace std; char reg[30]; int main() { //char reg[30]; char DNA[30]; int flag = 0; int n, ni, i, j, k; cout << "Enter a regular expression" << ; cin >> reg; cout << endl; n = reg.size(); for (int i = 0; i < n; i++) { strcpy(DNA, reg.substr(i, j)); ni = DNA.lenghth(); for (k = 0; k < ni;...
what is the output for the following code? explain the steps. /*#include <iostream> using namespace std; int f(int &i) { i = 10; return(5 * i); } int main() { int n = 5; f(n); cout << n << "\n"; return 0; } #include <iostream> using namespace std; int sub1(int n) { n--; return n; } int main() { int m = 10; for(int j = 0; j < 10; j++) m -= sub1(j); cout << m << "\n"; return...
What will be the output of the following C++ program?#include <iostream> #include <string>#include <cstring>using namespace std; int main(int argc, char const *argv[]){ const char *a = "Hello\0World"; cout<<a; return 0;}a) Hellob) Worldc) Errord) Hello World
CHALLENGE ACTIVITY 8.4.2: Find char in C string Assign a pointer to any instance of searchChar in personName to searchResult. #include <iostream> #include <cstring> using namespace std; int main() { char personName[100]; char searchChar; char* searchResult = nullptr; cin.getline(personName, 100); cin >> searchChar; /* Your solution goes here */ if (searchResult != nullptr) { cout << "Character found." << endl; } else { cout << "Character not found." << endl; } return 0; }
CONVERT THE FOLLOWING C/C++ PROGRAM INTO JAVA: //LinkedString.h #pragma once #include<iostream> #include<string> using namespace std; //declare a node datastruct struct Node { char c; Node *next; }; class LinkedString { Node *head; public: LinkedString(); LinkedString(char[]); LinkedString(string); char charAt(int) const; string concat(const LinkedString &obj) const; bool isEmpty() const; int length() const; LinkedString substring(int, int) const; //added helper function to add to linekd list private: void add(char c); };...
SCREENSHOTS ONLY PLEASE!!! DON'T POST ACTUAL
CODE
PLEASE LEAVE A SCREENSHOT ONLY! ACTUAL TEXT IS NOT
NEEDED!!!
mystring.h:
//File: mystring1.h
// ================
// Interface file for user-defined String class.
#ifndef _MYSTRING_H
#define _MYSTRING_H
#include<iostream>
#include <cstring> // for strlen(), etc.
using namespace std;
#define MAX_STR_LENGTH 200
class String {
public:
String();
String(const char s[]); // a conversion constructor
void append(const String &str);
// Relational operators
bool operator ==(const String &str) const;
bool operator !=(const String &str) const;
bool operator >(const...
The code will not run and I get the following errors in Visual Studio. Please fix the errors. error C2079: 'inputFile' uses undefined class 'std::basic_ifstream<char,std::char_traits<char>>' cpp(32): error C2228: left of '.open' must have class/struct/union (32): note: type is 'int' ): error C2065: 'cout': undeclared identifier error C2065: 'cout': undeclared identifier error C2079: 'girlInputFile' uses undefined class 'std::basic_ifstream<char,std::char_traits<char>>' error C2440: 'initializing': cannot convert from 'const char [68]' to 'int' note: There is no context in which this conversion is possible error...
Can someone help with this C++ code. I am trying to compile and I keep running into these 4 errors. #include <iostream> #include <cassert> #include <string> using namespace std; typedef int fsm_state; typedef char fsm_input; bool is_final_state(fsm_state state) { return (state == 3) ? true : false; } fsm_state get_start_state(void) { return 0; } fsm_state move(fsm_state state, fsm_input input) { // our alphabet includes only 'a' and 'b' if (input != 'a' && input != 'b') assert(0); switch (state) {...