#include<iostream>
#include<cstring>
using namespace std;
int main()
{
char first[500];
cout<<"what is your favorite word : ";
cin>>first;
cout<<(strcat(first," Is a good choice"))<<endl;
cout<<"Size ;"<<(strlen(first));
return 0;
}
#include <stdio.h>
#include <string.h>
int main() {
/*
strcat(char * destination, const char *source)
attaches source to destination
*/
char buffer[100] = "Hello ";
strcat(buffer, "World!");
printf("Buffer: %s
", buffer);
return 0;
}
// with C++11
string result = name + std::to_string(age);
#include <iostream>
#include <cstdlib>
std::string text = "hello";
std::string moretext = "there";
std::string together = text + moretext;
std::cout << together << std::endl;
>> hello there
#include <iostream>
#include <cstring>
using namespace std;
int main()
{
char key[25], buffer[25];
cout << "Enter the key string: ";
cin.getline(key, 25);
cout << "Enter the buffer string: ";
cin.getline(buffer, 25);
strcat(key, buffer);
cout << "Concatenation = " << key << endl;
return 0;
}
string firstName = "John";
string lastName = "Doe";
string fullName = firstName + " " + lastName;
cout << fullName;
string first_name = "foo"
string last_name = "bar"
std::cout << first_name + " " + last_name << std::endl;
std::string s = "Hello";
std::string greet = s + " World"; //concatenation easy!
Path filePath = Path.of("C:UsersPublicDocumentslabelingLabel.prn");
try {
byte[] bytes = Files.readAllBytes(Paths.get(String.valueOf(filePath)));
commands = new String(bytes);
//Replace data
String cmd1 = commands.replaceAll("@Part@", PartLead);
String cmd2 = cmd1.replaceAll("@Date@", Adate);
cmdF = cmd2.replaceAll("@Shift@", Ashift);
} catch (IOException e) {
e.printStackTrace();
}
FileOutputStream os = new FileOutputStream("\localhostzebra1"); //printer Should be Shared
PrintStream ps = new PrintStream(os);
ps.println(cmdF);
ps.print("f");
ps.close();
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}
Code Example |
---|
Cpp :: count c++ |
Cpp :: options select from array |
Cpp :: priority queue in cpp |
Cpp :: c++ else if |
Cpp :: c++ pass function as argument |
Cpp :: valid parentheses in c++ |
Cpp :: abs c++ |
Cpp :: javascript if else exercises |
Cpp :: pointer to pointer c++ |
Cpp :: c++ function overloading |
Cpp :: file streams in c++ |
Cpp :: c++ constructor |
Cpp :: map of maps c++ |
Cpp :: print all number between a and b in c++ |
Cpp :: C++ Initialization of three-dimensional array |
Cpp :: gtest assert not equal |
Cpp :: graph colouring |
Cpp :: subtraction of a 2d matrix in c++ |
Cpp :: c++ get microseconds since epoch |
Cpp :: c++ throe |
Cpp :: how to code a game in c++ |
Cpp :: PascalName seperate strings |
Cpp :: c++ text between substrings |
Cpp :: c++ terinary operator |
Cpp :: library management system project in c++ using array |
Cpp :: last index of array c++ |
Cpp :: cpprestsdk header |
Cpp :: atomic int c++ add 1 |
Cpp :: how to move your chrector in unity |
Cpp :: how to refresh multiple command lines in C++ stream |