Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
of the string. Print the string in a length that is twice the field width.
int main()
{
cin >> num1 >> num2 >> num3 >> num4 >> num5;
largest = num1;
smallest = num1;
largest = num1;
largest = num2;
largest = num3;
largest = num4;
largest = num5;
smallest = num1;
smallest = num2;
if ( num3 < smallest )
smallest = num3;
smallest = num4;
smallest = num5;
return 0;
}
Write a program that prints a table of a binary, octal and hexadecimal
equivalents of the decimal numbers in the range 1 to 256.
#include <iostream.h>
int main()
{
cout << "Decimal\t\tBinary\t\t\tOctal\tHexadecimal\n";
do {
cout << ( number < factor && number >= ( factor / 2 ) ? '1' : '0' );
factor /= 2;
number %= factor;
} while ( factor > 2 );
return 0;
}
Or
#include <iostream>
#include <iomanip>
#include <limits>
int main ()
{
const int uint_d = numeric_limits<UINT>::digits;
#include <iostream>
using std::cin;
using std::cout;
using std::endl;
int main()
{
double* firstNumber = NULL;
cout << endl << "Enter first number: ";
cin >> *firstNumber;
system("PAUSE");
return 0;
}
include<iostream>
class employee{
char name;
int age;
name= name1;
age-age1;
Void main(){
Employee e1,e2;
Cout<<Emplyees created.
}
Write a program to compare two files containing same type of records
using overload operators.
#include <iostream>
#include <string>
#include <fstream>
using namespace std;
int main()
{
// Create ostream object that writes to file outfile
ofstream fout ("step2out.txt");
//Call functionCounter
number = functionCounter(count_N, number);
//Construct array
string *A;
A = new string[number];
return 0;
}
//FUNCTION HERE--------------------------------------
int functionCounter(int count_N, int number)
//-------------------------------------------------
//Prompt user to enter the name of the file to be read
{ string fileName;
cout << "Enter name of your dictionary file: ";
cin >> fileName;
//While the file is open count the number of words and print the file in reverse form
if (fin.is_open())
{
//Define and initialize variables
int count_N=0;
string n;
return -1;
}
hint I'm supposed to use an english dictionary file "dictionary.txt" to compare to an article
(another text file), find matches and show a counter of each time that word appears in the article.
Or
/* here is a very basic program to compare files - chamkila! */
#include
#include
#include
#define ANSI
#ifdef ANSI /* ANSI compatible version */
#include
void closeFiles(FILE* fh, ...);
#else /* UNIX compatible version */
#include
void closeFiles(va_list);
#endif
void printUsage(void)
{
printf("usage: fcmp.exe , nn");
}
void displayError()
{
printf("error: %sn", strerror(errno));
return;
}
va_start(argptr, fh);
f = va_arg(argptr, FILE*);
if (NULL != f)
{
fclose(f);
}
va_end (argptr);
return;
}
#else /* UNIX compatible version must use old-style definition. */
void closeFiles(va_alist)
{
FILE* f = NULL;
va_list argptr;
va_start(argptr);
f = va_arg(argptr, FILE*);
if (NULL != f)
{
fclose(f);
}
va_end (argptr);
return;
}