Do While loop on C++
I need to program a do while loop in which the...
Do While loop on C++
I need to program a do while loop in which the user have
to choose between option A,a, B,b or C,c. I need a do while loop
that if other letter (different from options is choose) the loop
print a cout saying "Invalid selection. Plese, enter the selection
again.
I have one, but isn't working well
int main()
{
char option;
do
{
cout<<"Please choose one of the following options:
"<<endl<<endl;
cout<<"Option A - Julian...
Please find the errors of the following code
a)
int x[5];
int k = 10;
for...
Please find the errors of the following code
a)
int x[5];
int k = 10;
for (k = 0; k <= 5; k++)
{
x[k] = k -1;
}
b)
int x[5];
for (k = 1; k <= 5; k++)
{
cout << x[k-1] << endl;
}
c)
int x[5]={1,2,3,4,5}, y[5];
y = x;
for (k = 0; k < 5; k++)
{
cout << y[k] << endl;
}
d)
int size;
cin >> size;
int myArr[size];
I'm having a warning in my visual studio 2019, Can anyone please
solve this warning.
Severity ...
I'm having a warning in my visual studio 2019, Can anyone please
solve this warning.
Severity Code Description
Project File Line Suppression
State
Warning C6385 Reading invalid data from
'DynamicStack': the readable size is '(unsigned int)*28+4' bytes,
but '56' bytes may be read.
Here is the C++ code were I'm having the warning.
// Sstack.cpp
#include "SStack.h"
// Constructor
SStack::SStack(int cap) : Capacity(cap), used(0)
{
DynamicStack = new string[Capacity];
}
// Copy Constructor
SStack::SStack(const SStack& s) : Capacity(s.Capacity),
used(s.used)...
1) Create a flowchart for the program below and Trace the
program below with input of...
1) Create a flowchart for the program below and Trace the
program below with input of 3 and then again with input of 5.
#include <iostream>
using namespace std;
int Fall(int x, int m)
{ int Xm = 1, i=x;
while(i>=x-m+1)
{ Xm = Xm*i;
i=i-1;
}
return Xm;
}
int Delta(int x, int m)
{ int ans = 0;
ans = Fall(x+1,m);
ans = ans - Fall(x,m);
return ans;
}
void main()
{ int x = 0, m =...
can someone edit my c++ code where it will output to a file. I
am currently...
can someone edit my c++ code where it will output to a file. I
am currently using xcode.
#include <iostream>
#include <cctype>
#include <cstring>
#include <fstream>
using namespace std;
bool inputNum(int [],int&,istream&);
void multiply(int[],int,int[],int,int[],int&);
void print(int[],int,int,int);
int main()
{ifstream input;
int num1[35],num2[35],len1,len2,num3[60],len3=10,i;
input.open("multiplyV2.txt"); //open file
if(input.fail()) //is it ok?
{ cout<<"file did not open please check it\n";
system("pause");
return 1;
}
while(inputNum(num1,len1,input))
{inputNum(num2,len2,input);
multiply(num1,len1,num2,len2,num3,len3);
print(num1,len1,len3,1);
print(num2,len2,len3,2);
for(i=0;i<len3;i++)
cout<<"-";
cout<<endl;
print(num3,len3,len3,1);
//cout<<len1<<" "<<len2<<"
"<<len3<<endl;
cout<<endl;
}
system("pause");
}
void...