Answer:
A Program was written to carry out some set activities. below is the code program in C++ in the explanation section
Explanation:
Solution
CODE
#include <iostream>
using namespace std;
int main() {
string name; // variables
int number;
cin >> name >> number; // taking user input
while(number != 0)
{
// printing output
cout << "Eating " << number << " " << name << " a day keeps the doctor away." << endl;
// taking user input again
cin >> name >> number;
}
}
Note: Kindly find an attached copy of the compiled program output to this question.
Answer: Other people can access the same network and may have access to parts of your computer to try and steel your data.
Explanation:
Answer:
public class newass {
/*
Write a method, makeSubjectLine, that gets a String argument and returns the same String but with "Subject: " in front
of it. So if the argument is "Are you going to the show?" the method returns "Subject: Are you going to the show?".
*/
public static void main(String[] args) {
System.out.println(makeSubjectLine("Are you going to the show?"));
}
public static String makeSubjectLine(String subj){
return "Subject: "+subj;
}
}
Explanation:
The solution in Java Programming Language
Explanation:
The pointer is the variable that will store the address of the other variable of the same datatype.
Following are the disadvantages of using a pointer.
1. Pointer sometimes causes a segmentation fault in the program.
2. Sometimes pointer leads to a memory leak.
3. A pointer variable is slower than normal variable.
4. Sometimes the program is crash if we using pointer because sufficient memory is not allocated during runtime.
5. If we using pointer it is difficult to find the error in the program.
Answer:
#include <stdio.h>
void spaces(int n) {
for(int i=0; i<n; i++) {
putchar(' ');
}
}
void numbersdown(int n) {
for(int i=n; i>1; i--) {
putchar('0'+i);
}
}
void numbersup(int n) {
for(int i=1; i<=n; i++) {
putchar('0'+i);
}
putchar('\n');
}
int main(void) {
int number;
printf("Please enter a digit: ");
scanf("%d", &number);
for(int i=number; i>0; i--)
{
spaces(number-i);
numbersdown(i);
numbersup(i);
}
}
Explanation:
I deliberately separated the solution into different functions for readability. If needed, the code could be made much more compact.