What is the Difference between assembler and macro?
I am not sure about the answer but think so,
Assembler: Its a program that converts a low level language into machine code, and there is a one-to-one correspondence between the source language statements and machine instructions
Macro- Assembler: It performs the same task as does the assembler but there is some times a one-to-many correspondence between the source language statements and machine instructions.
Please discuss further...
Where can you find information on a J C Higgins 12 GA model 20-12 pump action SRO 58358?
www.histandard.info
What are register variables What are the advantage of using register variables?
Asks the compiler to devote a processor register to this variable in order to speed the program's execution. The compiler may not comply and the variable looses it contents and identity when the function it which it is defined terminates.
What makes for a good or bad variable name in C plus plus programming languages?
A good variable name is one that is clear, related to the data it stores. Also, you should try to avoid confusions with other variables.
Does The modulus operator can be used with a long double?
No. Nor with float or double. Use function dreml (or remainderl).
Write a program to find the average of three numbers using c language?
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c;
float avrg;
printf("enter the first number:");
scanf("%d",&a);
printf("enter the second number:");
scanf("%d",&b);
printf("enter the third number:");
scanf("%d",&c);
avrg=(a+b+c)/3.0;
printf("The average of given numbers is:%f",&f);
getch();
}
this c program is specifically for three variables only.
Is cursor implementation possible in queue or stack?
yes,cursor implementation possible in priority queue.
When can a function prototype be omitted?
when we write definition of a function i.e; body of a function above main() function, then the function prototype be omitted.
-Ramashankar Nayak,M.C.A,Pondicherry University
What is the difference between Char a equals string and char a equals String?
Well, if you write like char a=string; it is wrong. You have to declare the size of the array or else put the brackets immediately after the variable declaration. You also have to put the string in quotes, or provide a comma-separated list of characters. E.g.,
char a[]={'s','t','r','i','n','g'};
Or more simply:
char a[] = "string";
Remember that C/C++ is case-sensitive and that all keywords are lower case. Thus Char would be regarded as an invalid keyword.
Which data type is the only one that can be used in calculations?
Which data type is the only one that can be used in calculations?
How many tokens are present in C?
There are 6 types of Tokens in C which are as follows:-
1. Keyword
2. Identifier
3. Constants/Literals
4. Variable
5. Operator
6. Punctuator
Do complex control structures improve the readability of programs?
Yes. However a control structure need not be complex. A control structure is simply a language mechanism that allows us to more easily express an otherwise procedural concept. For instance, consider the following procedural loop:
int x=0;
again:
if (!(x<10)) goto end;
// lots of statements...
++x;
goto again:
end:
This loop is much more easily expressed using a control structure:
for (int x=0; x<10; ++x) {
// lots of statements...
}
The resulting machine code will be exactly the same, so the level of complexity has not changed in any way. However, the latter is arguably much more readable because the loop conditions are all stated up front where they are easily seen and the body of the loop is contained within the loop statement itself.
General form of three looping statement?
1. do statement while (condition);
2. while (condition) statement
3. for (exp1; condition; exp2) statement
4. LABEL: statements goto LABEL;
The sizeof long int is platform-dependent, often 4 bytes or 8 bytes.
Generally,the cautery settings should be 60-80 cut and 60-80 coag. Set on blend.
Write a cpp program to convert entered date into words?
#include<iostream>
#include<sstream>
#include<chrono>
#include<ctime>
std::string months[12] { "January", "February", "March", "April", "May", "June", "July",
"August", "September", "October", "November", "December"};
class date
{
public:
date (std::string = "");
date (size_t dd, size_t mm, size_t yyyy);
date (const date& dt): d{dt.d}, m{dt.m}, y{dt.y} {}
date (date&& dt): d{dt.d}, m{dt.m}, y{dt.y} {}
date& operator= (const date& dt) { d = {dt.d}, m = {dt.m}, y = {dt.y}; return *this; }
date& operator= (date&& dt) { d = {dt.d}, m = {dt.m}, y = {dt.y}; return *this; }
static bool is_leap_year (size_t year);
static date today ();
static bool validate (size_t dd, size_t mm, size_t& yyyy);
size_t day() const { return d; }
size_t month() const { return m; }
size_t year() const { return y; }
operator std::string () const;
private:
size_t d;
size_t m;
size_t y;
};
bool date::is_leap_year (size_t year)
{
if (!(year%4)) return false;
if (!(year%100)) return true;
if (!(year%400)) return false;
return true;
}
date date::today()
{
time_t tt = time (nullptr);
struct tm *tm = localtime (&tt);
return date (tm->tm_mday, tm->tm_mon+1, tm->tm_year+1900);
}
bool date::validate (size_t dd, size_t mm, size_t& yyyy)
{
// There was no year zero!
if (!yyyy)
return false;
// There is no day zero!
if (!dd)
return false;
// Check day and month combinations.
switch (mm)
{
case 2:
if (dd > 29 (dd > 28 && !date::is_leap_year (yyyy)))
return false;
break;
case 1: case 3: case 5: case 7: case 8: case 10: case 12:
if (dd > 31)
return false;
break;
case 4: case 6: case 9: case 11:
if (dd > 30)
return false;
break;
default:
return false;
}
// 10 dates were skipped during the switch from Julian to Gregorian
if (yyyy==1582 && mm==10 && dd>4 && dd<15)
return false;
// The date is valid!
return true;
}
date::date (size_t dd, size_t mm, size_t yyyy): d {dd}, m {mm}, y {yyyy}
{
if (!validate (dd, mm, yyyy))
throw std::range_error ("date (size_t,size_t,size_t) - invalid date values!");
}
date::date (std::string ddmmyyyy)
{
if (!ddmmyyyy.size())
{
date dd (today());
d = dd.d;
m = dd.m;
y = dd.y;
return;
}
const std::string error {"date(std::string) - invalid argument!"};
const std::string valid {"0123456789\"};
// check for invalid characters
if (ddmmyyyy.find_first_not_of (valid) != ddmmyyyy.npos)
throw std::range_error (error);
// locate first slash
size_t s1 = ddmmyyyy.find('\\');
if (!s1 s1 ddmmyyyy.npos)
throw std::range_error (error);
// ensure no more slashes
size_t s3 = ddmmyyyy.find ('\\', s2+1);
if (s3 != ddmmyyyy.npos)
throw std::range_error (error);
// parse string
std::string sd = ddmmyyyy.substr (0, s1);
std::string sm = ddmmyyyy.substr (s1+1, s2-s1-1);
std::string sy = ddmmyyyy.substr (s2+1, ddmmyyyy.size()-s2);
std::stringstream ss;
ss << sd << " " << sm << " " << sy;
size_t dd, mm, yyyy;
ss >> dd;
ss >> mm;
ss >> yyyy;
if (!validate(dd,mm,yyyy))
throw std::range_error (error);
d = dd;
m = mm;
y = yyyy;
}
date::operator std::string () const
{
std::stringstream ss;
ss << d << '\\' << m << '\\' << y;
return ss.str();
}
int main()
{
date d;
std::string input;
while (true)
{
std::cout << "Enter a date (dd\\mm\\yyyy): ";
std::cin >> input;
try
{
date t {input};
d = t;
break;
}
catch (std::range_error& e)
{
std::cerr << e.what() << std::endl;
}
}
std::cout << "Date: " << d.day();
switch (d.day() % 10)
{
case (1): std::cout << "st"; break;
case (2): std::cout << "nd"; break;
case (3): std::cout << "rd"; break;
default: std::cout << "th"; break;
}
std::cout << " " << months[d.month()-1] << ", " << d.year() << std::endl;
}
What is the difference between shell sort and merge sort?
shell uses an odd number,merge uses an even number?
Allocation is a set amount of (something), often money or goods. It's something you might get, and I might get, but we all get the same amount of it.
The school set a $250.00 uniform allocation per student.